Restricting IP access to a specific website page
hello awesome people of cpanel
i am looking to restrict access to a specific page in my website to a number of ip addresses
i already looked into blocking ip option in cpanel or in htaccess but this will block the entire website - i just want to restrict a single page per example the CMS login page
is this doable on whm/cpanel ?!
thank you
-
Hello, Here are a couple of examples of how to do this from StackOverflow discussions: password protect a single file using .htaccess Password protecting a single page using .htaccess and .htpasswd Thank you. 0 -
What CMS? If Wordpress you could consider using a plugin: Restricted Site Access 0 -
What CMS? If Wordpress you could consider using a plugin: Restricted Site Access
no a CMS for a regular website not wordpress .. i want to IP restrict it0 -
In your htaccess file, you could try the following format: Order deny,allow Deny from all Allow from 127.0.0.1 Allow from 127.0.0.2
where file.ext is the file you want to restrict the access to, and 127.0.0.1, 127.0.0.2 etc are the IPs you want to allow access to that file (add as many as you need) If the file you are trying to protect is in a sub-folder, you might need to create an additional htaccess file with the above code in the folder that contains the file0 -
In your htaccess file, you could try the following format:
Order deny,allow Deny from all Allow from 127.0.0.1 Allow from 127.0.0.2
where file.ext is the file you want to restrict the access to, and 127.0.0.1, 127.0.0.2 etc are the IPs you want to allow access to that file (add as many as you need) If the file you are trying to protect is in a sub-folder, you might need to create an additional htaccess file with the above code in the folder that contains the file
the page im looking to restrict is something like this : example.com/admin/login.php so the page is login.php .. how do i know if i need another htaccess ? this login.php is inside /public_html/admin and the htaccess is in public_html0 -
Add a new .htaccess file into the folder /admin with the code above, replacing the 'file.ext' with login.php and changing the IPs as required 0 -
Add a new .htaccess file into the folder /admin with the code above, replacing the 'file.ext' with login.php and changing the IPs as required
worked perfectly ! thank you0 -
You are very welcome. 0 -
hello again after all this time i was looking to deny access to a certain page except for my public ip i used the below in .htaccess but it is even blocking the ip address i am allowing - i am writing something wrong ? [CODE=php] Order deny,allow Deny from all Allow from 102.68.xx.xx 0
Please sign in to leave a comment.
Comments
9 comments