Thursday, September 01, 2005

More On 301 Permanent Redirects

About six months ago I wrote about 301 permanent redirects. (See 301 Permanent Redirects)

A number of people have been asking questions about this topic, in particular looking for ways to deal with large numbers of pages that have been renamed or deleted.

The following applies to web sites hosted on UNIX (or similar) systems. Web sites hosted on Windows servers will require the assistance of the System Administrator to set up redirects.

If all the files in a folder have been deleted you can use a single line in your .htaccess file to redirect all attempts to reach a page in that folder to a different page. This .htaccess file must be placed in the folder from which all files were deleted. The line to put in the .htaccess file is:

redirectMatch 301 ^(.*)$ http://www.website.com/newpage.html

Using the above, anyone who attempts to reach any page in the folder containing this .htaccess file will be sent to http://www.website.com/newpage.html

If you have renamed all the files in a folder, then you will still need to put a separate line in the .htaccess file for each page that was renamed. This follows the format:

Redirect 301 /oldpage.html http://www.website.com/newpage.html

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home