View Single Post
Old 12-22-2004, 05:22 AM  
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
A quick and dirty!

I tried to get it to a one-liner but I must've missed something. This way works at least.

Create a file that is called "edit.sh" and add this to it:

Quote:
#!/bin/bash

echo "Deny from someip" >> $1
echo "RewriteRule .*\.(gif|GIF|Gif|jpg|JPG|jpeg)$ http://www.mydomain.com/error.jpg [R,NC]" >> $1
The ">>" will append the text to the .htaccess. Change it to ">" if you want to over write.

Change the file to "chmod 755 edit.sh".

Now run this from the main directory where you can find the .htaccess files:

Quote:
find . -name .htaccess -maxdepth 2 -exec ./edit.sh {} \;
Change "./edit.sh" to the correct path to edit.sh.
"-maxdepth 2" will only look for .htaccess maximum 2 directories deep, change to suit your needs.

DISCLAIMER!
If you fuck up, I'm not responsible
It worked for me. So try it in a test directory first and see if it will look the way you want it.
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote