Forum Moderators: phranque
http://example.co.uk/example.uk.com/<anything> to http://example.uk.com/<anything> here? Is that what you are asking? http://example.uk.com/<anything> are internally rewritten to point to the internal server path at /var/www/example.uk.com/<anything> (or similar) too. Is that correct?
RewriteCond %{HTTP_HOST} ^(www\.)?example\.co\.uk$
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(php|html?)\ HTTP/
RewriteRule ^example\.uk\.com/(([^/]+/)*)index\.(php|html?)$ http://www.example.uk.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^(www\.)?example\.co\.uk$
RewriteRule ^example\.uk\.com/(.*)$ http://www.example.uk.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^example\.co\.uk
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(php|html?)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(php|html?)$ http://www.example.co.uk/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^example\co\.uk
RewriteRule (.*) http://www.example.co.uk/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^(www\.)?example\.uk\.com
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(php|html?)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(php|html?)$ http://www.example.uk.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^example\.uk\.com
RewriteRule (.*) http://www.example.uk.com/$1 [R=301,L] # Internally REWRITE direct uk.com requests to internal folder
RewriteCond %{HTTP_HOST} ^www\.example\.uk\.com$
RewriteCond $1 !^example\.uk\.com$
RewriteRule (.*) /example.uk.com/$1 [L] [edited by: tedster at 8:53 pm (utc) on Feb 23, 2011]
[edit reason] fix typo [/edit]
Host: www.example.com" request sent by the browser. GET /somepath/somefile HTTP/1.1" request sent by the browser. [edited by: jdMorgan at 7:07 pm (utc) on Mar 4, 2011]
[edit reason] speling in varname. [/edit]