Tags

, ,


Overview

During the life of a web site it may undergo a name change and rather than have visitors hit the old web site you may wish to have them automaticaly redirected to a new web address. To achieve this, web servers allow administrators (and web site owners with access to the file system) to implement re-directs using a special file.

The Apache Web Server uses a file called a “.htaccess” file, this file enables fine grained control at a directory or sub-directory level. To implement a redirect from an old site to a new site, you can create a .htaccess file using a text editor on your computer and upload it to the web site. The change will take effect immediately.

The following lines need to be entered into the .htaccess file.

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.my-new-site.com.au/ [R=301,L]

Ensure that the name is .htaccess the “.” is significant!

FTP it into your web site document root and test. If it fails without an error contact your web site administrator to verify that the web server config allows .htaccess files (normally enabled by default).

Enjoy!

Advertisements