Web Hosting Talk







View Full Version : Mod Rewrite (Redirect All domains if it does not match)


EvilMan
08-06-2009, 05:01 PM
Hey all,

I have a friend who has like 250 domains going to this one site. Right now if you go to each doain, they are just added as a alias and loas the page. He wants to do a 301 redirect where if the domain they are coming from is now www.HISPRIMARYDOMAIN.com then to redirect them there.


Obiosly doing HTACCESS redirects would be brutal for 500 diffrent redirects.

foobic
08-06-2009, 06:28 PM
That's a standard one:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.hisprimarydomain.com$ [NC]
RewriteRule (.*) http://www.hisprimarydomain.com/$1 [R=301,L]