Techie Tip of the Week: Redirect Web Pages to New Locations – permanent redirect method

Last week, we talked about using the META REFRESH method to redirect visitors to your web pages to new locations. This week, we’ll show how you can manipulate the web server to permanently redirect visitors to the new location even before the old web page opens.

Permanent Redirect Option

To permanently redirect visitors to new locations:

  1. Create a text file with the filename .htaccess
  2. In this .htaccess file, enter the following, substituting oldlocation with the relative reference to the redirected page (relative to the root level of the web server) and newlocation with the fully-qualified (complete, full address) URL of the new location:

    redirect 301 oldlocation newlocation

    So, for example, if the old location was http://www.stanford.edu/group/widgets, and the new location is http://www.stanford.edu/dept/cgi-bin/widgetdepartment, the .htaccess file should read:

    redirect 301 /group/widgets http://www.stanford.edu/dept/cgi-bin/widgetdepartment

  3. Save.
  4. Upload the .htaccess file to the appropriate directory on your web server.

Another way to implement a 301 (permanent) redirect:

Upload a .htaccess file in the directory you wish to redirect from with the following:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) newlocation$1 [R=301,L]

So, in our example:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)
http://www.stanford.edu/dept/cgi-bin/widgetdepartment/$1 [R=301,L]

Tags: , ,

Leave a Reply

You must be logged in to post a comment.