How to restrict acces to specific friendly URL by IP in Wordpress site?

Igal @ igal at
Fri May 19 21:49:17 UTC 2017


On 5/19/2017 12:24 AM, ohmykot wrote:
> What I tried so far in my website config:
> [code]
> location ~* ^/secret-page/ {
> allow;
> deny all;
> }
> [/code]
> But this didn't work. It returns 404 error when I try to open this page from
> allowed IP. Looks like it tried to find the real file or directory
> /secret-page/ rather than return a friendly URL page if I got it right.

I assume that you mean rewritten URL when you say Friendly URL? Please 
paste your rewrite rule for that location.

But in general I think that you should remove the rewrite rule for that 
location, and add the following:

Assuming that you mean a secret directory rather than page, add alias or 
root directive, e.g.

location ~* ^/secret-page/ {
   deny all;

   alias       /path/to/physical/secret-dir/;

If it really is a single page then try:

location = /secret-page/ {

   deny all;

   try_files 	/path/to/physical/file

Igal Sapir
Lucee Core Developer <>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list