user1637326
user1637326

Reputation: 11

RewriteRule and php get variables

Here is my challenge.

My www.mysite.com/lab/brand/folder/modify.php page has a flash app that get a variable from the url for example www.mysite.com/lab/brand/folder/modify.php?id=1234 The flash app pulls the 1234 as the id and there are a ton of files located in the folders near that app that I can't move and keep the app working correctly.

I tried the following but the app doesn't pull in the get variable. It does rewrite the url but the flash app doesn't seem to get the variable.

^lab/modify/([0-9]+)/?$ lab/brand/folder/modify.php?id=$1 [QSA,L]

I'd be happy with the rewriten url to look like www.mysite.com/lab/modify.php?id=1234 if that would work for get get variable but I don't know how to write this. I tried the following but that didn't work so I know I'm writing this wrong.

^lab/modify.php?id=([0-9]+)/?$ lab/brand/folder/modify.php?id=$1 [QSA,L]

Any help you can provide would be greatly appreciated.

Thanks LP

Upvotes: 0

Views: 932

Answers (1)

Mihai Iorga
Mihai Iorga

Reputation: 39704

It's just as simple as:

RewriteRule ^lab/modify/$ lab/brand/folder/modify.php [QSA]

the QSA flag (Query String Append) will add your GET variables for any URL Like:

www.mysite.com/lab/modify/?id=1234

You can get variable with: $_GET['id']

Upvotes: 1

Related Questions