在url中使用带有两个变量的mod_rewrite

时间:2011-10-17 12:24:31

标签: apache .htaccess mod-rewrite

你好我设置了一个重写,它完美地工作,这里是

RewriteRule ^polls-([0-9]+)\.html$ poll.php?poll_id=$1

这将允许像polls-1.html这样的URL而不是poll.php?poll_id = 1。

我的问题是这个;我有另一个变量来查看结果,这是我通常会调用的 - poll.php?poll_id = 1& showResults = 1

我如何设置一个规则,我可以使用一些东西:polls-1 / results-1.html ??我搜索网了一段时间,但无法找到任何东西

1 个答案:

答案 0 :(得分:1)

添加另一条规则,如下所示:

RewriteRule ^polls-([0-9]+)\/results\.html$ poll.php?poll_id=$1&showResults=1

它会将polls-1/results.html重定向到poll.php?poll_id=1&showResults=1

相关问题