How to redirect one domain to other domain with all query string variables (htaccess)

/, Tutorials & Tips/How to redirect one domain to other domain with all query string variables (htaccess)

How to redirect one domain to other domain with all query string variables (htaccess)

If you ever have the need to move domain names, the following .htaccess code will help move all visitors to your second domain name. This method also preserves your URLs’ query string variables, so there’s a less likely chance of something breaking.

You can use this:

RewriteEngine On
RewriteCond %{HTTP_HOST} firstdomain.com$
RewriteRule ^(.*)$ http://www.seconddomain.net/$1 [L,R=301]

Similar Posts:

By |2015-05-22T06:32:35+00:00May 22nd, 2015|Programming & Code, Tutorials & Tips|1 Comment

About the Author:

Alvin Poh lives in Singapore, and is interested in marketing, techy stuff, and likes to just figure out how the two can work with each other. He can also be found on Google+.

One Comment

  1. Neil December 21, 2015 at 5:14 am - Reply

    I was looking for this solution from past 2 days, at last i found it. Let me try your method on my domain.

Leave A Comment


*