158Views3Replies

Author Options:

How can I restrict visitors to certain areas of a website based on IP address? Answered

I want to create two directories on a website: one is only accessible from certain IP addresses, and the other one available to everyone except those IP addresses. I think that the .htaccess mod_rewrite would work best, but how should I do it?

3 Replies

user
NachoMahmaBest Answer (author)2009-03-18

. You're on the right track. This should help.

Select as Best AnswerUndo Best Answer

user
MePerson (author)NachoMahma2009-03-18

Thanks. I forgot to mention that I want it to automatically redirect, but that can be done easily in PHP with a if...else statement and the IP variable.

Select as Best AnswerUndo Best Answer

user
NachoMahma (author)MePerson2009-03-18

. More than one way to skin that cat. PHP will work. Or you can use the refresh meta. Or mod_rewrite.

Select as Best AnswerUndo Best Answer