gpt4 book ai didi

linux - 将参数发布到 htaccess sef 链接

转载 作者:太空狗 更新时间:2023-10-29 12:13:30 25 4
gpt4 key购买 nike

我有前任的网址:

 http://www.demo.com/a/abcd

我使用这个 htaccess 来发布这个 url 的值

RewriteRule ^a/(.*)$ /details.php?sef=$1 [L,NC]

但是我需要得到新的参数贴在url上例如:

 http://www.demo.com/a/abcd?id=123&qu=11

那么如何在不对 URL 进行任何更改的情况下通过此 url 获取 idqu 变量值?

最佳答案

来自 Apache's docs on mod-rewrite :

Modifying the Query String

By default, the query string is passed through unchanged. You can, however, create URLs in the substitution string containing a query string part. Simply use a question mark inside the substitution string to indicate that the following text should be re-injected into the query string. When you want to erase an existing query string, end the substitution string with just a question mark. To combine new and old query strings, use the [QSA] flag.

由于您正在重写查询字符串,因此请使用 QSA 标志:

RewriteRule ^a/(.*)$ /details.php?sef=$1 [NC,QSA,L]

关于linux - 将参数发布到 htaccess sef 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33233204/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com