【发布时间】:2012-11-18 16:24:55
【问题描述】:
我在使用 Apache Mod_Rewrite 模块时遇到问题,
我正在从 get 请求中检索三个变量
$country
$state
$location
本地重写url成功 例如网址
localhost/directory/country/state/location /*is redirected to*/
localhost/directory/result.php?c=country&s=state&l=location
我想做的是我要重定向
localhost/directory/country to localhost/directory/country.php?c=country
如果是
localhost/directory/country/state to localhost/directory/state.php?c=country&s=state
我正在使用以下 RewriteRule
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ result.php?s=$1&d=$2&l=$3 [L]
如果我想只显示国家页面,我该如何重写国家和州,以及如果我只想显示国家页面..
非常感谢!! 请通过提供在线教程和其他参考资料来帮助我。
我非常有义务为您提供同样的服务.. :)
【问题讨论】:
-
使用更少的占位符和您的其他/缩短的替换网址/参数复制该规则。
标签: php apache redirect rewrite