.htaccess的设置问题

43次阅读

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_\/]+)$ index.php/$1 [L]

目前用以上语句把 xxx.com/index.php/abc 简写为 xxx.com/abc

现在想在此基础上 abc.xxx.com 也同样可以访问 xxx.com/index.php/abc 请问该怎么写。

PS:我已经将abc.xxx.com的ip解析过去了

sai8808

RewriteCond %{REQUEST_HOST} (abc)\.xxx\.com
RewriteRule ^(.*)$ index.php/%1 [L]

正好最近在写这个, 注意用%1

chenge

正文完