Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Is there a way to use .htaccess to ban IPs store in a file?


php_Guy

Recommended Posts

Posted

I would like to use .htaccess to ban all the IPs listed in a file instead of listing all the IPs directly in the .htaccess file itself.

 

From what I can gather from apache.org and other sites there is no way to do this but I'm hoping I just missed something.

 

Anyone know?

Posted
I would like to use .htaccess to ban all the IPs listed in a file instead of listing all the IPs directly in the .htaccess file itself.

 

From what I can gather from apache.org and other sites there is no way to do this but I'm hoping I just missed something.

 

Anyone know?

 

RewriteMap does exactly what I want but it isn't allowed in .htaccess files <sigh> Guess I just can't do it that way.

Posted
RewriteMap does exactly what I want but it isn't allowed in .htaccess files <sigh> Guess I just can't do it that way.

Did you see this?

Posted

 

I did, thanks.

 

What I have are various lists of known hackers, spam bots, annoying spiders, etc that I ban that way via .htaccess now.

 

Then I have modified versions of all the security mods here. Two of them generate lists of IPs that I want to block and then check the lists, via application_top.php, on every page request and deny any IP found in those lists. That works just fine but .htaccess banning is much faster than php script banning and as the lists grow that could become significant. More so since my shared host is overloading their php server.

 

I could regularly cut and paste from the two dynamically generated files into .htaccess but it would be nicer to have .htaccess just read the files and ban all the IPs contained therein.

 

Hmm.. I guess I could create a cron job to scan the files and recreate a new .htaccess file every day. At least that would automate it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...