Alex Mcp
Alex Mcp

Reputation: 19315

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

I have a page that already has the $_GET array initialized, and 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?

Upvotes: 2

Views: 590

Answers (1)

Wim
Wim

Reputation: 11252

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.

Upvotes: 1

Related Questions