Sound Choice Internet Support Redirecting Web Pages

Our server now supports redirection on a per-directory basis. You can use the commands described below to redirect hits from one page to another. This is useful if, for example, you've decided to rename a page and want those going to the old location to automatically find the new one. You can also customize your error messages so, for example, a "page not found" message gives people a bit more information. Redirections can also be useful if people are frequently misspelling the name of your page -- you can send them to the right one automatically.

Redirecting Web Pages

To redirect hits to a specific page, just enter a line like the following into the .htaccess file in that page's directory:

Redirect pagename full-new-URL
The "pagename" should be the page (i.e. relative URL) that you want redirected. The "full-new-URL" should be the full URL of the location to which you want the users sent. For example, suppose you no longer had the page "top10.html" and wanted people trying to find that page to go to "top50.html" instead. To do this, you would add the following line to your .htaccess file:
Redirect /this.html http://www.company.com/here.html

Customizing Error Responses

As you've browsed the Web, you've more than likely run into a case where you've clicked on a link that is no longer valid. When the page isn't found, you'll often get an error that read "404 File not found", or something similar. If you'd like to provide a "friendlier" response when users get an error from your site, you can specify an HTML page to be displayed in place of any error message. To do this, add a line like the following to your .htaccess file:

ErrorDocument error-code error-page
The "error-code" is the numeric code for the server error. The number 404 (file not found) is the most common. The "error-page" should be the absolute URL of the page which the user should see if they encounter that error. You can specify unique Error Documents for each subdirectory of your Web site by customizing the .htaccess file in each one. If you want to redirect file-not-found errors to a page called "error.html" that tells the user how to find the rest of your site, you could use a line like:
ErrorDocument 404 http://yourdomain.com/error.html

For redirecting errors caused by unauthorized access to a password restricted area, you would use something like:
ErrorDocument 401 /must_subscribe.html

where "/must_subscribe.html" is the file in your top-level directory which contains the proper response for failed authorization attempts. Note: You must give a local file, rather than a full URL if you are trapping a 401 error.


Sound Choice Internet. Support Center
http://scc.net/techsupport/
© 1997, Sound Choice Internet.
staff@scc.net
phone: (651) 999-0999
fax: (651) 644-7990