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

时间:2015-08-29 08:40:11

标签: php apache .htaccess

我正在使用共享主机(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 个答案:

答案 0 :(得分: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 :(得分:1)

更新: 问题是由单词之间的空格字符引起的:allow,deny。

订单允许,拒绝

相关问题