【问题标题】:.htaccess & mod_rewrite.htaccess & mod_rewrite
【发布时间】:2013-01-24 23:54:29
【问题描述】:

我有以下几点:

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

【问题讨论】:

    标签: php .htaccess mod-rewrite url-rewriting


    【解决方案1】:
    RewriteRule  ^(.*)/(.*\.php)?$ index.php?city=$1 [L]
    

    【讨论】:

      猜你喜欢
      • 2011-01-12
      • 2014-05-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-04
      • 2012-11-05
      • 2011-11-17
      • 2011-05-04
      相关资源
      最近更新 更多