开发者

.htaccess rewrite clashing with $_GET parameters

开发者 https://www.devze.com 2023-02-16 01:22 出处:网络
So, integrating this third party tracking service that passes a $_GET parameter to our product pages.The page is rewritten in .htaccess and they pass the query string starting with a question mark (?)

So, integrating this third party tracking service that passes a $_GET parameter to our product pages. The page is rewritten in .htaccess and they pass the query string starting with a question mark (?) and $_GET doesn't pick it up unless its an ampersand (&).

So this is the htaccess rewrite.

RewriteRule ^the-url/(.*?)/(.*?)/?$ /the-page.php?slug=$1/$2 [L]

This works

http://www.site.com/the-url/someones-name/a-title&something=4

This does not (but I need it to. Notice the question mark rather than ampersand)

开发者_如何学JAVA

http://www.site.com/the-url/someones-name/a-title?something=4

Thanks


I guess you have to use the [QSA] flag:

RewriteRule ^the-url/(.*?)/(.*?)/?$ /the-page.php?slug=$1/$2 [L,QSA]

If this flag is set, the given query string will be appended (QSA = Query-String Append), not removed.

0

精彩评论

暂无评论...
验证码 换一张
取 消