I’m trying to make a RewriteRule with get parameters. It’s a simple example but still don’t work.
RewriteRule ^/?localhost/([0-9]+) test.php?id=$1 [QSA]
So if I go to localhost/123 i want the 123 as $_GET in the test.php script.
Any idea why this fails? All other ‘normal’ RewriteRules work perfectly.
The
localhostis the domain, and doesn’t belong in theRewriteRule. And I have changed your[QSA]to[L,QSA]so no further rules are executed.If this needs to be restricted so it only rewrites if the domain is localhost, then you would use a
RewriteCondlike:That would be useful if you had a rewrite to perform under development only, but not when deployed to a production server.