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

ohmykot nginx-forum at
Fri May 19 07:24:43 UTC 2017

I've got a server with nginx and a wordpress website running on it.

On the web-site, I have a wordpress page, i.e., that
I want to restrict access to everybody but 1 specific IP address of my other

As this page is not a real physical directory, but just a friendly URL - I
got stuck. I don't have previous experience configuring nginx, but I tried
hard to google the possible solution.

What I tried so far in my website config:
location ~* ^/secret-page/ { 
deny all; 

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.

Can you help me please?

Posted at Nginx Forum:,274314,274314#msg-274314

More information about the nginx mailing list