Posted By

batfan on 08/21/10


Tagged

htaccess


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

roli000
hisamu


HTACCESS - Redirect Secondary Domains to Primary Domain


 / Published in: Apache
 

This is if you have multiple domains pointed to the same directory on a server.

  1. Options +FollowSymLinks
  2. RewriteEngine On
  3. RewriteCond %{HTTP_HOST} ^secondarydomain1.com$ [OR]
  4. RewriteCond %{HTTP_HOST} ^www.secondarydomain1.com$
  5. RewriteRule (.*)$ http://www.primarydomain.com/$1 [R=301,L]
  6.  
  7. RewriteCond %{HTTP_HOST} ^secondarydomain2.com$ [OR]
  8. RewriteCond %{HTTP_HOST} ^www.secondarydomain2.com$
  9. RewriteRule (.*)$ http://www.primarydomain.com/$1 [R=301,L]

Report this snippet  

You need to login to post a comment.