【问题标题】:How to add ADDITIONAL url parameters to my mod_rewrite rules如何将附加 url 参数添加到我的 mod_rewrite 规则
【发布时间】:2017-05-03 08:29:34
【问题描述】:

好的,问题来了

我有大约 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.

如何在整个站点中通用地添加这些额外的 url 参数?

【问题讨论】:

    标签: apache mod-rewrite


    【解决方案1】:

    在末尾添加 QSAL 标志。

    标记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]
    

    【讨论】:

    • 不起作用,它不断拆分 index.html 删除参数并进行内部重定向
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-09
    • 2012-01-18
    相关资源
    最近更新 更多