Forum Moderators: phranque
[test.example.com...] -> http://www.example.com/sd_test
I'm trying to modify it, but I can't figure it out I'm not very good with regex. What I want is:
[test.example.com...] -> http://www.example.com/multisites/test
Here is the script I am using, if anyone could tell me how to make this quick fix I'll buy you a beer. :D Here is the script:
Options +FollowSymLinksRewriteEngine on
# Canonicalize all requested hostnames
RewriteCond www>%{HTTP_HOST} ^(www)>example\.co\.uk [OR]
RewriteCond %{HTTP_HOST} ^(www)\.example\.co\.uk\. [OR]
RewriteCond %{HTTP_HOST} ^(www)\.example\.co\.uk:[0-9] [OR]
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.(www\.)?example\.co\.uk [OR]
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.?example\.co\.uk
RewriteRule (.*) http://%1.example.co.uk/$1 [R=301,L]
#
# Externally redirect direct client requests for www.example.com/sd_xyz to xyz.example.com
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /sd_[^/]+/
RewriteRule ^sd_([^/]+)/(.*)$ http://$1.example.co.uk/$2 [R=301,L]
#
# Internally rewrite xyz.example.com to filepath example.com/sd_xyz, except for "www.example.com"
RewriteCond $1 !^sd_
RewriteCond %{HTTP_HOST} !^www\.example\.co\.uk
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.co\.uk
RewriteRule (.*) /var/www/example.co.uk/public/sd_%1/$1 [L]