首页 文章

.htaccess导致ERROR 500 - 内部服务器错误

提问于
浏览
1

我正在使用共享主机(apache,php,wordpress),同时试图阻止访问.htaccess和wp-config我得到了

错误500 - 内部服务器错误

我做的是将这些放入.htaccess:

# protect the wp-config file
<files wp-config.php> 
Order allow, deny
Deny from all
</files> 

# Prevent access to .htaccess
<Files .htaccess>
Order allow, deny
Deny from all
</Files>

这就是我的.htaccess中的全部内容 .
我按照大多数网站上的示例进行了说明 . 如果我扫一下订单:

Order deny,allow
Deny from all

没有内部错误,但这不是我在大多数网站指南中看到的 . 如果有人知道为什么以及使用什么 .

2 回答

  • 4

    这是在Apache 2.2还是Apache 2.4服务器上? Apache 2.4中的Order / Deny规则已更改,请参阅http://httpd.apache.org/docs/trunk/upgrading.html

    如果是Apache 2.4,那么这两行:

    Order deny,allow
    Deny from all
    

    将被替换为:

    Require all denied
    

    或者,如果它是您拥有的服务器,您还可以启用mod_access_compat模块,该模块是2.4的兼容模块,支持2.2配置 . 但由于它是一个共享托管,我怀疑你能做到这一点,除非你很好地问他们 .

  • 1

    更新:问题是由单词之间的空格字符引起的:允许,拒绝 .

    Order allow, deny

相关问题