GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   .htaccess question, pulling up external list.txt (https://gfy.com/showthread.php?t=951848)

mkx 02-03-2010 06:55 PM

.htaccess question, pulling up external list.txt
 
Need to use the same list of IP's to block on a few of my sites. Can I make it go to a list.txt file on the server somehow?

Current .htaccess:
##### start anti spy squirrel script
deny from XX.XX.XX.X
ErrorDocument 403 /error.html
##### end anti spy squirrel script

want to:

##### start anti spy squirrel script
deny from http://www.mysite.com/list.txt
ErrorDocument 403 /error.html
##### end anti spy squirrel script

and in list.txt i will list the ip's I want to block line by line.

How do I properly say this line?
deny from http://www.mysite.com/list.txt

anicetan 02-03-2010 07:18 PM

I think you can do it with mod rewrite

mkx 02-03-2010 07:31 PM

code perhaps?

darksoul 02-03-2010 09:05 PM

you can't do that with .htaccess alone.

GrouchyAdmin 02-03-2010 09:11 PM

Quote:

Originally Posted by darksoul (Post 16811091)
you can't do that with .htaccess alone.

Why did you base64 encode your ICQ?

Also, what's stated here.

It'd be easier for you just to make a script which reads the list.txt and prepends it to your .htaccess

This has no bounds checking and is dumb as hell, but will do what you want. Trivially wrapped as a CGI so you can activate via browser rather than shell. Again, it's stupid, but it's free.

addnewbans.cgi:
Code:

#/bin/sh
echo "Content-type: text/plain"
echo ""
echo "Parsing list.txt in current directory..."
for n in `cat list.txt`; do echo "deny from $n" >> newshit
cp .htacess .htaccess-last
mv newshit .htaccess
cat .htaccess-last >> .htaccess
echo "Done. .htaccess has new bans set; last copy is saved as .htaccess-last"

Edit: For denying a specific URL you'll want to use mod_rewrite.

Code:

RewriteCond %{HTTP_REFERER} ^http://clownpenis\.fart/booz.html [NC, OR]...
RewriteRule ^.*$ - [F]


mkx 02-03-2010 09:32 PM

Thanks dude will try that out


All times are GMT -7. The time now is 02:44 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123