I’m trying to tweak some rewrites in an .htaccess file but my regexp/mod_rewrite knowledge is thin!
We have primarydomain.com and secondarydomain.co.uk, and we want to rewrite anything and everything to http://www.primarydomain.com
At present I’m doing this:
RewriteCond %{HTTP_HOST} ^secondarydomain.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.secondarydomain.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^primarydomain.com$
RewriteRule (.*)$ http://www.primarydomain.com/$1 [R=301,L]
.. but I’m sure there is a better way?? Is there a rule that would rewrite any host that’s not http://www.primarydomain.com? I tried playing about with the not operator (!) and managed to cause a redirect loop so don’t want to do that :/
Any help appreciated! Ben
Ok, Found it myself: