Hello all,
I would like to transform an URL like :
http://sub.domain.com or http://www.sub.domain.com
into something like http://www.domain.com/sub/
but sub must not be certain values like : mail, www or images and some others...
I wanted to try this kind of rule but before trying I'd like to know if it is correct or not , can you tell me if you think it seems ok or if there is any problem ?
RewriteEngine on
# First rule block to deal with the http://www.sub.domain.com
RewriteCond %{HTTP_HOST} !^www\.www\.domain\.com$
RewriteCond %{HTTP_HOST} !^www\.mail\.domain\.com$
RewriteCond %{HTTP_HOST} !^www\.images\.domain\.com$
RewriteCond %{HTTP_HOST} ^(www\.*)\.domain\.com$
# Second rule to deal with the http://sub.domain.com
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
RewriteCond %{HTTP_HOST} !^mail\.domain\.com$
RewriteCond %{HTTP_HOST} !^images\.domain\.com$
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com$
# ok rewrite now
RewriteRule (.*) http://www.domain.com/%1$1 [P]
Thanx a lot
LeDruide