views:

28

answers:

1

Hi

i m newbie in URL rewriting.. frankly speaking i have no idea bout using regexp Here is what i want to do .. i want a url rewrite rule for

www.mydomain.com/news/this is new title/1

this shud call/go to

www.mydomain.com/news/display.asp?id=1

similarly

www.mydomain.com/articles/this is article title/1

shud call/go to

www.mydomain.com/article/display.asp?id=1

I guess. both the above patterns can be done in via one rule

I will be using ISAPI_Rewrite Lite (FREE) add on for enabling my IIS server for IIS rewrite.. http://www.helicontech.com/

This is sample rewrite url rule i got from the documentation .. hope this helps u

RewriteRule (.*?\.asp)(\?[^/]*)?/([^/]*)/([^/]*)(.*) $1(?2$2&:\?)$3=$4$5
A: 

got the solution .. but not sure if this the best approach ..

I had to write 2 rules in order to handle urls without trailing slash. If u know how to combine them then plz reply

RewriteRule (.*)/(.*)/([0-9]+)/$ $1/details.asp?mod_id=$3 [NS,I]
RewriteRule (.*)/(.*)/([0-9]+)$ $1/details.asp?mod_id=$3 [NS,I]
suraj jain