开发者

Using URL Redirection based on domain name using UrlRewritingNet.UrlRewriter

I want to redirect a request in an asp.net web site based on the domain, my scenario is like this.

I have the app setup so that it will process the requests from multiple domains like from www.abc.com and www.xyz.com, now i want that when ever a request comes to the www.abc.com/default.aspx the url wou开发者_开发技巧ld be rewrites to the www.abc.com/custom/abcdefault.aspx while for all the other requests like for www.xyz.com/default.aspx it should do nothing.

I am currently using the UrlRewritingNet.UrlRewriter for the URL rewriting,

Thanks,


try something along this:

<add name=”Redirect_abc.com”  virtualUrl=”^http\://www.abc.com/default.aspx”
rewriteUrlParameter=”ExcludeFromClientQueryString”
destinationUrl=”http://www.xyz.com/custom/abc.default.aspx″
redirect=”Domain”
redirectMode=”Permanent”
ignoreCase=”true” />

This just matches the pattern you specified before but can easily be changed to match another patetrn.

Regards

Jonathan

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜