简体   繁体   中英

.htaccess file on windows server

I have done research and found that my htaccess file will not work on my new Windows server. I have seen that I should be using web.config.

I tried it and couldn't get anything to work. Then I saw that I can use an htaccess file, but I have to call it something else (like htaccess.txt).

I tried that but couldn't get it to work. I read later that I needed to call it something else then change my "AccessFileName". I have looked everywhere but still have absolutely no idea how to do that.

Any help is greatly appreciated! I am using a Godaddy Windows server.

you do indeed have to use a web.config file. The GoDaddy Windows server you are using is running a webserver program called IIS, which uses web.config files. .htaccess is used by Apache HTTPD, which is a different web server.

The stumbling block you were probably hitting when you tried it last time is that a web.config file has substantially different syntax than an .htaccess file. Microsoft has a Knowledge Base article about setting up a web.config file, and a syntax reference linked within it

I tried everything and find this

<system.webServer>
<staticContent>
  <remove fileExtension=".mp4"/>
  <remove fileExtension=".m4v"/>
  <remove fileExtension=".ogg"/>
  <remove fileExtension=".ogv"/>
  <remove fileExtension=".webm"/>
  <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
  <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
  <mimeMap fileExtension=".ogg" mimeType="video/ogg" />
  <mimeMap fileExtension=".ogv" mimeType="video/ogg" />
  <mimeMap fileExtension=".webm" mimeType="video/webm" />
</staticContent>

</system.webServer>

hope it helps

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