The web is a dynamic place and individual pages or entire sites are occasionally moved to new locations on the server or to other servers. Since people may have bookmarks or links to the old location it is a good practice to leave behind a pointer to the new location. There are many ways to do this, but a simple page listing the URL of the new page is very effective. Anyone viewing the page will see that it has moved and can update any links they have. Spiders -- programs that search and index the web automatically -- won't understand that the page has moved, but they will find the link to the new location.
If an entire subdirectory of pages has moved or been superseded you can delete all of the pages from the original location and use a web server configuration file to direct all requests to the single page with the new link information. First update the welcome.html file in the subdirectory to direct people to the new location. Next, in the same subdirectory create a file named .htaccess (note the initial dot!) containing a line like this:
ErrorDocument 404 redirectURL
Finally, erase everything no longer needed in the subdirectory. This may leave only the .htaccess and welcome.html files. This is effective even if there were further levels of subdirectories.
For example, there is a subdirectory referred to by the URL:
by placing a .htaccess file in the /Providers/MoveDemo directory containing this line:
ErrorDocument 404 /Providers/MoveDemo/welcome.html
any URL that refers to anything in /Providers/MoveDemo/ is directed to the welcome.html file which provides the link to the new location. For example, this page doesn't exist:
and a request for it will be directed to the welcome page.
This page was last updated on 2003-05-20. Please direct questions and comments regarding this page to email@example.com.
An Equal Opportunity University