RedirectMatch

Spent too much time today trying to get mod_rewrite to behave. The problem was simple enough, but I just couldn’t get reliable behaviour out of it. Thought I needed it because straight Redirect doesn’t do regex. Then found RedirectMatch, which is exactly that – redirects with pattern matching. Is this httpd’s best-kept secret?

What I hate is that when you’re reading complicated docs and examples on something like mod_rewrite, nobody ever puts a line in there: “By the way, if you’re like 99% of people, you’ll probably find that RedirectMatch accomplishes the same thing but much more easily.” Nope. Nerds gotta do it the hard way or it doesn’t count.

Leave a Reply

Your email address will not be published.