Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an easy, simple, lazy way to test rules against Apache's mod_rewrite?

I want to test the effects of my RewriteRules without going through all the trouble of setting up a vhost and a RewriteLog and throwing URLs at the browser (or curling them).

But I don't just wanna test regular expressions. I want my URLs to actually go through Apache's mod_rewrite stack, and I want to see the response that would come out of it.

Awesome if I could get some trace of which rules acted on the URL, with which order, and what the interim results were. (I guess most of this appears in the rewrite log, but I wanted to avoid that setup)

Is there any tool for this out there?

I'm ok with it not being able to handle RewriteConds, since those generally rely on the request headers and whatnot.

like image 585
kch Avatar asked Oct 27 '22 02:10

kch


2 Answers

I haven't come across a mod_rewrite validator, but setting up a vhost may have been quicker than posting here :)

Your best bet is unit testing. Provide rewrite rules and a list of expected results then get a regular report. I don't know your environment but Google results look promising.

Hope that points you in the right direction!

like image 180
Al. Avatar answered Nov 07 '22 13:11

Al.


Here is an online htaccess tester:

http://htaccess.madewithlove.be/

(as per https://stackoverflow.com/a/5907896/190791)

like image 42
Timothée HENRY Avatar answered Nov 07 '22 13:11

Timothée HENRY