I'm trying to redirect a url from a non-query version to a query version with EE.

I can get the redirect working properly on a .php flat-file, such as:

RewriteCond %{QUERY_STRING} ^$
RewriteRule ^test.php$ /test.php?var=1&var=2 [R=301,L,QSA]

However, I can not get a normal EE url like this to work:

RewriteCond %{QUERY_STRING} ^$
RewriteRule ^testpage$ /testpage?var=1&var=2 [R=301,L,QSA]

I suspect it has to do with how EE handles queries.

1 Answer 1


I've written a fairly robust set of mod_rewrite .htaccess rules for EE; I've got a couple of rules in there that will deal with query strings, hopefully it'll solve your problem.

Note: you'll need all four of the cases I have in there, which should be a complete set of cases needed for query strings and removing index.php from the URL; those four cases would be used to replace whatever rules you have in place to handle that functionality now.

You may need to make a few minor tweaks, but, that Gist is pretty well documented; please let me know if you have any questions about it.

  • Great! I'll look into this and see if that works.
    – xxx
    Jan 7, 2014 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.