http://www.example.com/20
http://www.example.com/21
and I have a map.txt
- Code: Select all
jim 20
tom 21
I use this to rewrite http://abc.example.com to http://example.com/abc/
how can I modify this to rewrite http://jim.example.com to http://example.com/20 ?
Any help appreciated ^_^
- Code: Select all
Options +FollowSymLinks
RewriteEngine On
# Fix missing trailing slashes.
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.example\.com$ [NC]
RewriteCond %{DOCUMENT_ROOT}/%2%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]
# Rewrite sub domains.
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.example\.com$ [NC]
RewriteRule ^(.*)$ /%2/$1 [QSA,L]