我有以下内容:
RewriteRule ^(.*)/(.*)\.php?$ index.php?city=$1 [L]
它可以捕获:mysite.com/salt-lake-city/file.php
我希望它也能抓住:mysite.com/salt-lake-city/并转发到:index.php?cit = salt-lake-city。我试图添加:
RewriteRule ^(.*)/?$ index.php?city=$1 [L]
然而,这最终转发到index.php?city = index.php
答案 0 :(得分:0)
RewriteRule ^(.*)/(.*\.php)?$ index.php?city=$1 [L]