Recursive rewrite

Aug 18, 2008 at 6:35 PM

I've read document and I am almost sure this can be done with conditions, but I don't know how to start. I'd like this: -> -> ->

RewriteRule ^/recipe/(\d+)/[^/]*/[^/]*/([^/]*) /recipe.asp?id=$1&$2
RewriteRule ^/recipe/(\d+)/[^/]*/([^/]*) /recipe.asp?id=$1&$2
RewriteRule ^/recipe/(\d+)/([^/]*) /recipe.asp?id=$1&$2


but there must be simpler way to do it? And my "recursion" doesn't work with the first line where there is no / at the end :-(

Any help would be appreciated.


Aug 21, 2008 at 1:46 PM

I suggest you start by fiddling with the testdriver - it is a good tool to quickly test out various rules and whether they work on various URL requests. You can specify incoming URLs, your desired outcome, and then run the testdriver and it will tell you if your rules do what you want them to do. Try out different things and you can iteratively develop the rules so they work just the way you want them.

Also see the examples on