.htaccess - 仅适用于 PHP?
我正在开发一个用 .net 开发的网站。我已经上传了 .htaccess 文件,但它不起作用。
对此有什么新的想法吗?我希望我的网站能够被 www 抓取。
谢谢
I am working on one website which is developed in .net. I have uploaded .htaccess files but its nt working.
Is there any new idea for that? I want that my site will be crawled with www.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
.htaccess
不仅仅适用于 PHP。它是由 Apache HTTP 服务器。因此,如果您的应用程序未在该服务器上运行,则该文件将不会产生任何影响。
.htaccess
is not just for PHP.It's a configuration file that's read by the Apache HTTP server. So if your application is not running on that server, then that file will not have any effect.
.htaccess
和 PHP 是正交的。一个是Apache的配置文件;另一种是脚本语言。您很可能使用的是 Microsoft 的 IIS 服务器,而不是 Apache。.htaccess
and PHP are orthogonal. One is a configuration file for Apache; the other is a scripting language. More than likely, you're using Microsoft's IIS server, not Apache..htaccess
文件是 Apache Web 服务器的配置文件,不依赖于 PHP。它通常包含与网站用户权限、友好 URL 定义等相关的设置。但是,如果您想要为此特定 Web 目录覆盖服务器的 PHP.ini 文件中的设置,它也可以包含 PHP 的配置设置。
许多原因导致
.htaccess
文件无法工作——它可能会被一些非常微妙的事情和错误的.htaccess
破坏文件通常会导致整个站点完全停止工作,无论错误是什么。在这种情况下,浏览器通常只会显示错误 500,而没有太多有用的信息来帮助您调试它。但服务器错误日志中会有更多有用的调试数据。
如果您仍然遇到困难,您应该在此处发布您的
.htaccess
文件,以便我们帮助您调试它。然而,正如 @Tomalk 所说,如果您正在开发 .NET 站点,那么您可能不会使用 Apache Web 服务器;而是使用 Apache Web 服务器。您可能正在使用 IIS 服务器。在这种情况下,有完全不同的方法来设置服务器的配置,并且它不知道如何处理
.htaccess
文件。The
.htaccess
file is a configuration file for the Apache web server, and is not dependant on PHP. It typically contains settings relating to web site user permissions, friendly URL definitions, etc.It can, however contain configuration settings for PHP, if you have settings which are in the server's PHP.ini file that you want to override for this specific web directory.
There are many reasons why a
.htaccess
file may not work -- it can be broken by some very subtle things, and a faulty.htaccess
file will normally cause the whole site to stop working completely, regardless of what the error is.In this case, the browser will usually simply show an error 500, without much useful information to help you debug it. But there will be more helpful debugging data in the server error log.
If you still struggle with it, you should post your
.htaccess
file here so we can help you debug it.However, as @Tomalk says, if you're developing a .NET site then you're probably not using an Apache web server; you're probably using an IIS server. In that case, there are entirely different ways of setting the configuration for the server, and it won't know what to do with
.htaccess
file.