Using .htaccess to redirect a web site on Apache

As web sites are migrated off of legacy servers it's important to establish a system to ensure visitors get to the new location. This can easily be done by creating a .htaccess file in the top level of your old web site. The .htaccess file should include the following commands:

RewriteEngine on
RewriteRule ^(.*) http://engineering.purdue.edu$1 [R=301,L]

These commands tell the web server that all traffic to your site should be directed to engineering.purdue.edu, if you are migrating your site to a different server the domain name should be altered.

The R=301 tells browsers and search engines that this move is permanent, which will result in search engines updating their indexes to refer to the new location.

 

 

Last modified: 2008/08/22 09:22:1.476000 GMT-4 by brian.r.brinegar.1
Created: 2008/08/22 09:13:44.252000 GMT-4 by brian.r.brinegar.1.

Categories

Search

Type in a few keywords describing what information you are looking for in the text box below.

Admin Options: Edit this Document