如何将ADDITIONAL url参数添加到我的mod_rewrite规则中

时间:2012-02-03 23:32:43

标签: apache mod-rewrite

好的,这就是问题

我有大约30个左右的重写规则:

    RewriteRule ^Frequently-Asked-Questions$ index.cfm?event=faqs-frequently-asked-questions 
    RewriteRule ^faq/([a-zA-Z0-9_-]+)/([0-9]+)$ index.cfm?event=faq&faqID=$2

所以这很有效,网址如下:

    www.example.com/Frequently-Asked-Questions

或         www.example.com/faq/why-wont-this-work/1234

完美地工作。

问题是当我们尝试在TOP上添加URL参数时,所以

    www.example.com/Frequently-Asked-Questions?phoneNum=123-345-2322 doesn't work at all.

如何在网站上普遍添加这些额外的网址参数?

1 个答案:

答案 0 :(得分:4)

添加QSA&最后L标志。

标记QSA Apache Docs 标记L Apache Docs

RewriteRule ^Frequently-Asked-Questions$ index.cfm?event=faqs-frequently-asked-questions [L,QSA]
RewriteRule ^faq/([a-zA-Z0-9_-]+)/([0-9]+)$ index.cfm?event=faq&faqID=$2 [L,QSA]