I want to redirect wildcard subdomains to the file "user_site.php" like the following :
RewriteCond $1 !^(user_site\.php|home_site\.php
RewriteCond %{HTTP_HOST} !^(www|mai开发者_开发问答l|ftp)?\.?domain.com [NC]
RewriteRule ^(.*)$ /user_site.php/$1 [L]
but if the subdomain is www or empty , i want to rewrite it to "home_site.php"
how can this be done ? Thanks
I've found it already answered here on stackoverflow , Thanks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^(www\.)?domain.com$ [NC]
RewriteRule ^(.*)/?$ home_site.php/$1 [NC,QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^/index.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} !^(www|mail).domain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([a-z0-9-]+).domain.com$ [NC]
RewriteRule ^(.*)/?$ user_site.php/$1 [NC,QSA,L]
精彩评论