Redirect old website / domain to new domain using htaccess

Posted by Damodar Bashyal on May 27, 2013

 

Today's task was to redirect all pages from an old domain to new domain except one page (google verification file). All pages including any query string should be stripped out and redirect to only homepage of new domain with out any query string.

This code snippet on htaccess did all the tricks:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{ENV:REDIRECT_STATUS} ^$
  RewriteCond %{REQUEST_URI} !^/googleace438179b7ee2497.html$ [NC]
  RewriteCond %{HTTP_HOST} ^(www\.)?technooze\.com$ [NC]
  RewriteRule (.*)$ http://www.dltr.org/? [R=301,L]
</IfModule>

charles posted on - Thursday 27th of June 2013 10:37:17 PM

This is a very nice post on <a >htaccess redirect</a> . Your article is great, i like it
 
not published on website


QR Code: Redirect old website / domain to new domain using htaccess