简体   繁体   中英

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

and so on :

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

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

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