简体   繁体   English

Windows 服务器上的 .htaccess 文件

[英].htaccess file on windows server

I have done research and found that my htaccess file will not work on my new Windows server.我做了研究,发现我的 htaccess 文件在我的新 Windows 服务器上不起作用。 I have seen that I should be using web.config.我已经看到我应该使用 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).然后我看到我可以使用 htaccess 文件,但我必须将其称为其他名称(如 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".后来我读到我需要将其称为其他名称,然后更改我的“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.我正在使用 Godaddy Windows 服务器。

you do indeed have to use a web.config file.您确实必须使用 web.config 文件。 The GoDaddy Windows server you are using is running a webserver program called IIS, which uses web.config files.您使用的 GoDaddy Windows 服务器正在运行名为 IIS 的网络服务器程序,该程序使用 web.config 文件。 .htaccess is used by Apache HTTPD, which is a different web server. .htaccess 由 Apache HTTPD 使用,它是一个不同的 Web 服务器。

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.您上次尝试时可能遇到的绊脚石是 web.config 文件的语法与 .htaccess 文件的语法大不相同。 Microsoft has a Knowledge Base article about setting up a web.config file, and a syntax reference linked within it Microsoft 有一篇关于设置 web.config 文件的知识库文章,以及其中链接的语法参考

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> </system.webServer>

hope it helps希望能帮助到你

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

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