Wish
Wish

Reputation: 1614

RewriteRule in .htacces to match my GET parameter needs

In our project, we started using .htaccess to prettify urls. Everything worked nice, untill I found, that our facebook login doesnt want to work, because GET parameters, that fb returns, cannot be catched in our code.

RewriteRule ^social/facebook$ /index.php/?action=social&authsocial=facebook

This rule breaks everything I need. it changes http://www.mydomain.com/index.php/?action=social&authsocial=facebook to http://www.mydomain.com/social/facebook.

So it parses 2 GET parameters. But when I use facebook login, they return bunch of GET parameters. How could I make rule, that would result in something like this http://www.mydomain.com/social/facebook?param1=12&qqq=13 ?

Basicly keep first part as it is now, but add not constant GET parameters as in old style?

Upvotes: 0

Views: 194

Answers (1)

Leri
Leri

Reputation: 12525

You need to append query string. You can achieve it by adding [QSA] at the end of RewriteRule:

RewriteRule ^social/facebook$ /index.php/?action=social&authsocial=facebook [QSA,L]

From documentation:

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.

Upvotes: 1

Related Questions