简体   繁体   English

如何在web.config中删除目录?

[英]How to remove directory in web.config?

I tried hard but maybe not enough, still, I just want to achieve this : 我尽了最大努力,但也许还不够,我只想实现以下目标:

mysite.com/en => mysite.com mysite.com/cn => mysite.com

and so on : 等等 :

mysite.com/en/page1 => mysite.com/page1 mysite.com/en/page1 => mysite.com/page1

<rule name="Redirect to en version" stopProcessing="true">
                <match url="(.*)\/en(.*)" />
                <action type="Rewrite" url="en/{R:1}" />
            </rule>

Obviously it doesn't work and i'm getting crazy with regex. 显然,它不起作用,我对正则表达式感到疯狂。

Thanks a lot for your help ! 非常感谢你的帮助 !

you need to disable directory browsing from IIS or from the web.config 您需要从IIS或从web.config禁用目录浏览

<configuration>
  <location path="Secured">
    <system.webServer>
      <directoryBrowse enabled="false" />
    </system.webServer>
  </location>
</configuration>

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

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