简体   繁体   English

URL重写模块上的正则表达式

[英]Regex on URL rewrite module

I need a help with Regex on URL rewrite module. 我需要有关URL重写模块的正则表达式的帮助。

I want to apply a rule for the home page. 我要为主页应用规则。

I tried with ^default.aspx, which is working fine when user access the site with /default.aspx 我尝试了^ default.aspx,当用户使用/default.aspx访问该站点时,它可以正常工作

But normally users are accessing the site with / (www.website.com/) so I am trying to write the reqex and not able to find the correct one. 但是通常用户使用/(www.website.com/)访问该站点,因此我试图编写reqex,但找不到正确的reqex。

I tried lot of different combination but nothing worked so far. 我尝试了很多不同的组合,但到目前为止没有任何效果。

^(/default.aspx|$|/$)
^(|/|/default.aspx)

Thanks for the help 谢谢您的帮助

You could use the following pattern: 您可以使用以下模式:

^(/|default.aspx)?$

It will match / , default.aspx or nothing 它将匹配/default.aspx或没有

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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