Wordpress拒绝访问Apache中的wp-admin目录

时间:2015-02-10 15:36:15

标签: wordpress apache .htaccess

我要做的是拒绝访问wp-admin(用户可以登录),并且只允许从特定的ip访问。

我把它们放到.htaccess但是我得到500内部服务器错误:

# BEGIN Custom rules
<Directory /wp-admin>
  Order deny,allow
  Deny from all
  Allow from x.x.x.x
</Directory>

# END Custom rules

1 个答案:

答案 0 :(得分:0)

将以下内容放入.htaccess文件,并将其放在wp-admin文件夹

# BEGIN Custom rules
<LIMIT GET>
  Order deny,allow
  Deny from all
  # whitelist IP address
  Allow from x.x.x.x
</LIMIT>

# END Custom rules