Tuesday, March 12, 2013

Redirect Old Domain to New Domain using .htaccess


 we can add the following lines to your .htaccess file located at the root of your old domain:
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>

To redirect a single page to a new location on the same domain, use the following syntax:
Redirect 301 /old/old.htm http://www.domain.com/new.htm

No comments:

Post a Comment