Webnetics UK Ltd. - Forums
Redirect to Files or Directories - Printable Version

+- Webnetics UK Ltd. - Forums (http://www.webneticsuk.com/forum)
+-- Forum: News & Announcements (http://www.webneticsuk.com/forum/forumdisplay.php?fid=2)
+--- Forum: VWDesigns Blog (http://www.webneticsuk.com/forum/forumdisplay.php?fid=12)
+---- Forum: Server (http://www.webneticsuk.com/forum/forumdisplay.php?fid=18)
+---- Thread: Redirect to Files or Directories (/showthread.php?tid=17)



Redirect to Files or Directories - webnetics - 04-12-07

You have just finished a major overhaul on your site, which unfortunately means you have renamed many pages that have already been indexed by search engines, and quite possibly linked to or book marked by users. You could use a redirect meta tag in the head of the old pages to bring users to the new ones, but some search engines may not follow the redirect and others frown upon it.

Enter this line in your .htaccess file:

Redirect permanent /oldfile.html http:// www. Your domain .com/filename.html

You can repeat that line for each file you need to redirect. Remember to include the directory name if the file is in a directory other than the root directory:

Redirect permanent /olddirectory/oldfile.html
http:// www. Your domain .com/newdirectory/newfile.html

If you have just renamed a directory you can use just the directory name:

Redirect permanent /olddirectory http:// www. Your domain .com/newdirectory

(Note: The above commands should each be on a single line, they may be wrapping here but make sure they are on a single line when you copy them into your file.)

This has the added advantage of preventing the increasing problem on the Internet, as people change their sites, of 'linkrot'. Now people who have linked to pages on your site will still have functioning links, even if the pages have changed location.