RSS

Don’t Use Plus (+) In mod_rewrite Rules

May 5, 2007    (Click to Rate!) Loading ... Loading ...

Technology


Apache HTTP Server

You know how every once in a while you will need to get neck-deep into some super obscure issue until you finally find the answer to it, and it’s so simple or ridiculous that you want to scream at the top of your lungs and share it with everyone? Well that just happened to me and from now on when that happens, I want to blog about it. If it just helps 1 other person, that’s great.

For you Apache admins out there, or folks working on RewriteRules for mod_rewrite on your Apache installs, remember that using the plus (+) character in your “path-to-query” rules won’t work.

We spent the last few hours working on a rule that was trying to match a URL with a plus in it, something like:

http://server.com/foo+bar&variable=value

and absolutely could not get our rule to match the URL. After hours of work we finally realized that it was the + character causing the match problem. We ended up adding a {1} in our regexp to match the +, but you could also try and match the ASCII value of 43 for the + character if you wanted and knew how to.

Share and Enjoy:
  • Facebook
  • MySpace
  • Twitter
  • Digg
  • StumbleUpon
  • Reddit
  • del.icio.us
  • Propeller
  • Mixx
  • Fark
  • FriendFeed
  • Google Bookmarks
  • Suggest to Techmeme via Twitter
  • Slashdot
  • Technorati
  • Tumblr
  • Yahoo! Buzz
  • Print
, , ,

This post was written by:

Riyad Kalla - who has written 1725 posts on The “Break it Down” Blog.

"Ultimately I just want to provide a resource that folks find useful."

Leave a Reply