301 redirection via .htaccess-mod_rewrite Apache redirection
« on: August 10, 2008, 04:33:46 PM »
If you do not want to set 301 redirection (permanent redirection) using PHP or ASP code then you can set it using mod_rewrite rule. Please note that you will require Apache web server to set this redirection. Following is the code that you will need to write in your .htaccess file to set the permanent redirection:

Code: [Select]
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^yourdomain.com [nc]
rewriterule ^(.*)$ http://www.yourdomain.com/$1 [r=301,nc]

Add above code in your .htaccess file and place it in the root folder of our web site.

Kevin