HTML and CSS Reference
Move a Page
Reorganize your URL structure to be more transparent to developers, visitors, and search engines, but always
make sure the old URLs for those pages still work.
In the words of the W3C, "Cool URIs don't change." Once you publish a URI, you should endeavor to make sure
that content remains at that URI forever. Other sites link to the page. Users bookmark it. Every time you
reorganize your URL structure you are throwing away traffic.
However, you do need to move pages. Sometimes it's a matter of search engine optimization. Sometimes it's
mandated by a change to a new content management system (CMS) or server-side framework. Sometimes it's
necessary just to keep the development process sane by keeping related static files close together.
Thus, the compromise: Move pages as necessary, but leave redirects behind at the old URLs to point users to
the new URLs. Done right, users will mostly never notice that this has happened.
As long as you don't actively break links, most external sites that point to you won't bother to update their
links. Then again, most of them won't update their links no matter what you do. That's why you need to keep
the old links working.
Every time you move a page, set up a redirect from the old page to the new page. In other words, configure
your web server so that rather than sending a 404 Not Found error when a visitor arrives at the old location, it
sends a 301 Moved Permanently or 302 Found response.
For example, when I published my first book, I put the examples at www.cafeaulait.org/examples/ . When I
published my second book, I needed to split that up by book, so I moved those files to
www.cafeaulait.org/books/jdr/examples/ . However, if you go to www.cafeaulait.org/examples/ , the server
sends this response:
HTTP/1.1 302 Found
Date: Fri, 06 Apr 2007 17:34:27 GMT
Content-Type: text/html; charset=iso-8859-1