Restrict Wordpress Page by IP

2019-08-14 20:05发布

I have a WordPress website and I want to restrict one of the pages to be accessible only by specific IPs. The page is a template for my WordPress theme. The php file of the template is called alley.php

Here is what I tried in the .htaccess file, placed in the template directory

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

but it's not working for me.

Thanks in advance!

2条回答
祖国的老花朵
2楼-- · 2019-08-14 20:31

I think this plugin will be helpful for you,

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

查看更多
够拽才男人
3楼-- · 2019-08-14 20:37

You almost had it, you had the allow and deny the wrong way around

<Files alley.php>
    order deny,allow
    deny from all
    allow from xxx.xxx.xxx.xxx
</Files>
查看更多
登录 后发表回答