【发布时间】:2009-12-08 14:37:22
【问题描述】:
我一直在通过previous solution 阅读递归 mod_rewrite 问题,这类似于我正在尝试做的事情,不同之处在于我通过 index.php 文件发送所有查询,所以不要需要在查询中指定脚本。
基本上我想在搜索引擎友好的 url 中递归转换任意数量的参数:
example.com/param1/val1/param2/val2/...
到常规查询字符串:
example.com/index.php?param1=val1¶m2=val2&...
到目前为止,我的尝试都没有成功:
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([^/]+)/([^/]+) $1=$2&%1 [L]
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)$ index.php?%1 [L]
有人可以提供任何建议吗?
【问题讨论】:
标签: php apache .htaccess mod-rewrite recursion