htaccess rewrite with query string

I have this php script which contains this line:

header('Location: redirect.php?eid='.$id);

Open in new window

In my .htaccess file, i have:

RewriteEngine On
Options +FollowSymlinks
RewriteRule ^redirect\.php$ [L]

Open in new window

I want the user to be redirected to:

but the redirect doesn't work, and just I'm taken to redirect.php?eid=xx

(The redirect was working fine before I tried to pass the query string)

LVL 25
Kyle HamiltonData ScientistAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RewriteRule ^redirect\.php [QSA,L]

as a RewriteCond is missing, I guess you probably want:

RewriteRule ^/+redirect\.php [QSA,L]

Note: these rules assume that they match after your php script sended the Location: redirect
Kyle HamiltonData ScientistAuthor Commented:
Still no luck. I don't get redirected.

location goes to:

and stays there...
> location goes to:
 and what's the problem? that's exactly what you asked for
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Kyle HamiltonData ScientistAuthor Commented:
No, that's not what I'm looking for.

in the .htaccess file I want to redirect the following:

to :
RewriteRule ^/admin/redirect\.php [QSA,L]
Kyle HamiltonData ScientistAuthor Commented:
still no luck... :/
can you please check access.log and error.log on the corresponding server
Kyle HamiltonData ScientistAuthor Commented:
There's no error in the error.log for today...
Kyle HamiltonData ScientistAuthor Commented:
what's puzzling me is that the redirect works fine if there is no query string...
Kyle HamiltonData ScientistAuthor Commented:
I don't know why this is working now, but this seems to have done it:

RewriteRule redirect.php [R=303]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
> .. that the redirect works fine if there is no query string
please post the entry from the working redirect from access.log
the other one, with query string, must be in access.log or error.log, otherwise you most likely checked the wrong server
Kyle HamiltonData ScientistAuthor Commented:
I appreciate the help. I still don't understand what makes it work, but so be it...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.