...

View Full Version : rewrite url for multiple domains



jasonpc1
06-12-2011, 07:10 PM
RewriteEngine on
RewriteCond %{HTTP_HOST} ^siteA.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.siteA.co.uk$ [OR]

RewriteCond %{HTTP_HOST} ^siteA.com$ [OR]

RewriteCond %{HTTP_HOST} ^www.siteB.com$ [OR]
RewriteCond %{HTTP_HOST} ^siteB.com$

RewriteRule ^(.*)$ "http\:\/\/www.siteA\.com$1" [R=301,L]


what i am having problems with is getting the url to rewrite is that were to visit say

www.siteA.co.uk
www.siteA.co.uk
siteA.com
www.siteB.com
siteB.com

and be taken to

www.siteA.com

or say
www.siteA.co.uk/myOtherPage.php
www.siteB.com/myOtherPage.php

and be taken to

www.siteA.com/myOtherPage.php

Cags
07-09-2011, 09:28 AM
What you have looks fairly accurate, but if you always want the same domain you could probably consider something along the lines of...


RewriteCond %{HTTP_HOST} !^www\.siteA\.co\.uk
RewriteRule .* http://www.siteA.co.uk%{REQUEST_URI} [R=301,L]



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum