简体   繁体   中英

Convert AddType rule from htaccess to web.config

I need to convert .htaccess

AddType application/x-httpd-php .txt

to web.config. Could you help me with it? I tried

    <configuration>
  <system.web>
    <httpHandlers>
      <add verb="*" path="*.txt" 
         type="php " />
    </httpHandlers>
  </system.web>
</configuration>

but it doesn't work for me. So at all I need to open txt files like php on IIS.

This works for me:

<configuration>
   <system.webServer>
      <staticContent>
         <mimeMap fileExtension=".syx" mimeType="application/octet-stream" />
         <mimeMap fileExtension=".tab" mimeType="text/plain" />
      </staticContent>
   </system.webServer>
</configuration>

Source: http://www.iis.net/configreference/system.webserver/staticcontent/mimemap

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