2011-03-08 155 views
0

我想重定向通配符子域文件「user_site.php」這樣的:虛擬子域

RewriteCond $1 !^(user_site\.php|home_site\.php  
RewriteCond %{HTTP_HOST} !^(www|mail|ftp)?\.?domain.com [NC] 
RewriteRule ^(.*)$ /user_site.php/$1 [L] 

但如果子域是WWW還是空的,我想改寫爲「home_site.php」

這怎麼辦? 感謝

回答

0

我發現它已經回答了在這裏計算器,感謝

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]