开发者

ASP.Net double URL Rewriting

开发者 https://www.devze.com 2023-03-12 10:21 出处:网络
I am using URL Rewriting to make my URLs more understandable(well, thats why it is used mostly). But I would like to further rewrite them to make them even more understandable.

I am using URL Rewriting to make my URLs more understandable(well, thats why it is used mostly).

But I would like to further rewrite them to make them even more understandable.

My home page is at /Pages/1/Home.aspx after rewriting with the below rule.

<rewrite url="~/Pages/(.+)/(.+).aspx" to="~/MainTemplate_$1.aspx?PageName=$2"/>

But I suppose it doesn't look good, at least for home page. So I have applied below rule again.

<rewrite url="~/index.aspx" to="~/Pages/41/Home开发者_如何转开发.aspx"></rewrite>

But that doesn't work. Redirect instead of rewrite works, but the address bar would show clunky details which I don't want.

How do I make it work?

Thanks!


Just had to rearrange the rule order to get it working. Pretty straight forward.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号