Tuesday, September 25, 2012

Redirect Old Domain to New Domain

How to redirect old domain to new domain through .htaccess? Here are few code formats which would helps to your site redirect old domain to new domain. You should add this code in .htaccess file.

Method – 1:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]

Method – 2:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} \olddomain.com$
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

Method – 3:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

Method – 4:

Redirect 301 / http://www.newdomain.com/



No comments:

Post a Comment

Facebook Likes, Increase FB Likes Free