简体   繁体   中英

How can write rewrite rule for my web application's url rewriting

i have My url like MyTravel/Tour/Inner.aspx?Pid=2&Cid=8 Goa/New-Goa/)

Here Pid and cid are coming from home page's menu which can be different according to menu selection.(My menu is created from database)

and some links generate url like MyTravel/Tour/displaypackage.aspx?Pid=32&Cid=18&deptf=ND

i rewrite it as MyTravel/Tour/Goa/new-goa/ here goa and new-goa are saved in my database table on the basis of pid and cid.

I have used urlrewriter.net(Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter) for Url rewritting

Please tell me how I write my rewrite rule to match these type of urls in my configuration file.

I think the () brackets you have around inner are confusing the issue so you have actually specified 4 parameters...

For:

MyTravel/Tour/displaypackage.aspx?Pid=32&Cid=18&deptf=ND

Try something like:

<rewrite url="~/MyTravel/Tour/displaypackage\.aspx\?Pid=([0-9]+)&amp;Cid=([0-9]+)&amp;deptf=([a-zA-Z]+)" to="~/MyTravel/Tour/$1/$2/$3" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM