Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mod_rewrite redirect one domain to another URL

Tags:

mod-rewrite

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

I have been reading the mod_rewrite docs and looking at what seems to be similar questions on SO and hacking away at my .htaccess with no joy. Either nothing is redirected or both domains are redirected.

Is it possible to do what need with mod_rewrite in .htaccess?

like image 583
Gyle Iverson Avatar asked Nov 13 '12 06:11

Gyle Iverson


1 Answers

Yes, it's 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>
like image 179
enzipher Avatar answered Oct 19 '22 08:10

enzipher