开发者

.htaccess question : Can I strip out a leading question mark?

开发者 https://www.devze.com 2022-12-10 08:35 出处:网络
I have a page that already has the $_GET array initialized, a开发者_如何学编程nd when a page redirects there (with an oAuth token) it appends the ?token=36264747 to the end.

I have a page that already has the $_GET array initialized, a开发者_如何学编程nd when a page redirects there (with an oAuth token) it appends the ?token=36264747 to the end.

Is there a way to write an .htaccess file for an Apache server that would either strip that question mark or (better) replace it with an ampersand?


You need the qsappend or QSA (query string append) flag for RewriteRule:

RewriteRule ^foo(.*)bar$ index.php?token=$1 [QSA]

will append token=$1 to the query string (the $_GET part), using ? or & as appropriate.

0

精彩评论

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