Mod Rewrite Tip

Just a quick mod_rewrite tip for everyone out there. I spent a little time today working on some rewrite rules for an upcoming feature on IntenseDebate. I didn’t realize before today, however, that query parameters are not part of the expression matching in mod_rewrite. That is, http://www.domain.com/url/param1/param2?abc=123, will stop matching after param2 in this case. When you think about it, this makes a lot of sense really…unfortunately I didn’t realize this until I spent a good 30-45 minutes in frustration wondering what was wrong with my regular expression. If you do want to do something with the query parameters you can access them by using the variable %{QUERY_STRING} in your script.

Hopefully this helps someone else out there.

This entry was posted in Code. Bookmark the permalink.

Comments are closed.