Mod_rewrite redirect one domain to another URL

I have freemagickey.com and gogomagickey.com domains pointing to the same Apache server. Any request to the gogomagickey.com domain should now be redirected to http://www.indiegogo.com/magickey-perfect-password-management/ .

I read mod_rewrite docs and looked at what similar questions like on SO look like and hack into my .htaccess without joy. Either nothing is redirected, or both domains are redirected.

Is it possible what is needed with mod_rewrite in .htaccess?

+6
source share
1 answer

Yes, it is possible, and I believe this should do the trick for you:

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} gogomagickey\.com$ [NC] RewriteRule ^(.*)$ http://www.indiegogo.com/magickey-perfect-password-management/ [L,R=301] </IfModule> 
+6
source

All Articles