• Welcome to Web Hosting Forum - A Web Hosting Community for Webmasters.
 

Recommended Providers

WordPress

Recent Topics

Forum Membership

Forum Membership

301 redirection via .htaccess-mod_rewrite Apache redirection

Started by Kevin, August 10, 2008, 04:33:46 PM


Hosting Offer


Kevin

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:

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

WordPress Hosting