php and apache

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: php and apache

Post by cpetercarter »

I don't understand why someone would want to go to a lot of trouble to build a website and then ban people from seeing it.
However, the answer to your question is 'no'. You can't dynamically modify .htaccess from php. You could however have a database which stored the IP addresses of the folk you wanted to ban, and a procedure for checking the ip address of each request against the banned list.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: php and apache

Post by Eran »

You can't dynamically modify .htaccess from php
How did you figure that? .htaccess is a regular file and can be modified with PHP. Your database approach is more correct, but the other option is feasible.
Post Reply