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

Recommended Providers

Fully Managed WordPress Hosting
lc_banner_leadgen_3
Fully Managed WordPress Hosting

WordPress Theme

Divi WordPress Theme
WPZOOM

Forum Membership

Forum Membership

301 redirection via .htaccess-mod_rewrite Apache redirection

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

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