learning-website-framework1-2 Exercise 3: Straddling Folders and Redirect Rules ============================================================================== PART A: Decide the home for three folders that could go either way ------------------------------------------------------------------- Principle: every page has exactly ONE home site. Other sites link to it. databases/ Candidates: programming, webdevelopment. Decision: programming. Its courses (relational databases, ORMs, NoSQL and search) are used across web, data and systems work, not only websites, and the programming site is the broadest of the two. The webdevelopment site links to the database courses from its backend and framework chapters. projects/ Candidates: programming, webdevelopment, or a site of its own. Decision: programming for now. The folder mixes web projects (catalogue and website-rebuild courses) with non-web ones (a database engine, an operating system kernel, a web browser engine). Keeping it whole is simpler than splitting it. Revisit if the web-framework projects grow: they could move to webdevelopment, and the old URLs would simply be redirected there. culture/ (currently holds japan/) Candidates: languages, humanities. Decision: languages, because the audience is the same (someone learning Japanese) and the pages are read alongside the language courses. The humanities site links to it from its Japan history pages. PART B: Redirect rules for the first site to move (languages) ------------------------------------------------------------- If the old site serves content by folder path (for example /japan/...), the rule to send an old language URL to the new site is one line in Apache: RedirectMatch 301 ^/(france|germany|hungary|japan|culture)(/.*)?$ https://languages.osztromok.com/$1$2 How it works: - ^/(france|germany|hungary|japan|culture) matches the first path segment and captures it as $1. - (/.*)? captures the rest of the path, if any, as $2. - The new URL keeps the same path, so /japan/hiragana-1/ becomes https://languages.osztromok.com/japan/hiragana-1/. Use 301 (permanent) once you are sure; during testing use 302 so browsers do not remember the redirect. Chapter 11 of Learning Website: Framework & Architecture covers building these rules from the site map automatically and checking every old URL. Check your own site's real URL pattern first. Open a few live course pages and compare the address with the folder path under content/. If they differ, the rule needs to be adjusted to match. WHY THIS WORKS AS AN ANSWER --------------------------- Folders that could go either way are the ones that cause arguments later, so the rule "one home, other sites link" is written down with a reason for each decision. Keeping the path the same on the new site makes redirects a mechanical rewrite of the host name, which is easy to generate, test and reverse.