cancel
Showing results for 
Search instead for 
Did you mean: 

Semi-block access to website from one IP only

Community Veteran
Posts: 6,111
Thanks: 1
Registered: 05-04-2007

Semi-block access to website from one IP only

Hi,

I'm looking for some ideas as to how I can control access to a certain website (PN-hosted, on CCGI) from a certain IP only. If we use the example of www.domain.com, what I want is for everyone - except from a certain IP - to just be able to access the website as normal. However, if someone attempts to access it from this particular IP, I want to generally block the access, while still allowing access through some method - maybe using a username and password - from that IP if needed. I know that using .htaccess I can deny access from a certain IP, and that I can password protect a website. The question is though, can I combine the two so .htaccess only asks for a username and password when accessing from a certain IP, and if the password is wrong, deny access to that IP?

Thanks in advance,
Thomas
3 REPLIES
avalon
Grafter
Posts: 361
Registered: 05-04-2007

Semi-block access to website from one IP only

I think it's possible to add some code to the header of php based pages to do this sort of thing. I remember reading an article with a similar question in a magazine a couple of years ago.

I'm not sure what good it is though. I mean if someone uses a publicly available proxy it would appear to be a different IP so wouldn't be recognised would it?
Community Veteran
Posts: 14,469
Registered: 30-07-2007

Semi-block access to website from one IP only

I'm not aware any any way to do what you want with .htaccess. You can accept/block by IP or ensure everyone logs in but not to restrict the login requirement to a particular IP address.
Community Veteran
Posts: 6,111
Thanks: 1
Registered: 05-04-2007

Semi-block access to website from one IP only

Thanks for your replies... for what it's worth, it's a static IP address I wanted to apply the restrictions too. Thanks for the lead though northbritish, it's something to look in to.

Thomas