Reputation: 23
I have denied all IPs except few in htaccess
file.
Now I want a new IP to allow access only 1 particular url (it is not a html page but a page from wordpress
). I do not want this IP to access other content of the website.
I do not want password protection as it will affect all other users.
Can we do something like that ?
Upvotes: 2
Views: 183
Reputation: 3013
Add the new ip
to the list of allowed ones, then restrict it to access all uri
s except to the allowed one.
Assume that you want to deny access of the user with IP:124.255.124.255
to all urls except of www.example.com/url-to-hide
.After granting access to all urls, Put the following code in .htaccess
file of the root directory:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^124\.255\.124\.255
RewriteCond %{REQUEST_URI} !^/url-to-hide$
RewriteRule ^(.*)$ - [F,L]
Upvotes: 1