我在.htaccess中有这个重写规则:
RewriteRule ^^babysitter/([^/]*)/([0-9]+)/? /hlp/index.php/babysitter/$1/?p=$2 [QSA,L]
所以如果我写这个URL:
的本地主机/ HLP /保姆/罗马/ 3618
浏览器会像这样重写它:
的本地主机/ HLP /保姆/ 3618
这是我不想要的东西,即使它返回正确的结果。
为了完整性,我写了整个.htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /hlp/
RewriteRule ^index\.php$ - [L]
RewriteRule ^^babysitters/([^/]*)/? /hlp/index.php/babysitters/?resume_location=$1 [QSA,L]
RewriteRule ^^babysitter/([^/]*)/([0-9]+)/? /hlp/index.php/babysitter/$1/?p=$2 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /hlp/index.php [L]
</IfModule>