Log in

View Full Version : [PHP] Pretty URLs - $_GET After URL?



Phrate
08-03-2010, 05:41 AM
Note: This is not a request on how to do pretty URLs.

Okay, so I've gotten these pesky things down (.htaccess) and now I've run into a problem.

I want to be able to have $_GET variables still available to use after the Pretty URL.

Example:
http://example.com/user/John?var=5

I've seen it done in many places, such as Facebook, but have yet to learn how to actually do it.

Schmoopy
08-03-2010, 07:13 AM
Would need to see how you're doing it atm, but with htaccess you can use the [QSA] flag to keep the query string intact.

Please post what you have if this doesn't help and I'll see if there's anything else I can think of.

Phrate
08-03-2010, 07:57 AM
Well, it's not a big .htaccess file or anything.


RewriteEngine on
RewriteBase /Project/Experiments

RewriteRule ^user/([A-Za-z0-9\_\-\/]+)$ users/page.php?u=$1

So the following link would work:
http://example.com/Project/Experiments/user/Phrate

But I want to be able to do:
http://example.com/Project/Experiments/user/Phrate?var=something