通过IP限制Wordpress页面

时间:2014-03-18 11:27:01

标签: php wordpress .htaccess

我有一个WordPress网站,我想限制其中一个页面只能由特定的IP访问。该页面是我的WordPress主题的模板。模板的php文件名为alley.php

这是我在.htaccess文件中尝试的内容,放在模板目录

<FilesMatch alley.php>
 Order Allow,Deny
 Allow from xxx.xxx.xxx.xxx
 Deny from all
</FilesMatch>

但它不适合我。

提前致谢!

2 个答案:

答案 0 :(得分:1)

你几乎拥有它,你有允许并拒绝错误的方式

<Files alley.php>
    order deny,allow
    deny from all
    allow from xxx.xxx.xxx.xxx
</Files>

答案 1 :(得分:0)

我认为这个插件会对你有所帮助,

http://wordpress.org/plugins/restricted-site-access/