IP Blocker Script

  • Dream4Muse
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 22, 2003
  • Posts: 18
  • Status: Offline

Post July 22nd, 2003, 7:25 pm

In a post that was made back in February, the following code was posted to block an IP address :

<Limit GET POST>
order allow,deny
allow from all
deny from 111.111.111.111
</Limit>

Is it possible to make that code direct someone to a specific error message (ie. "error.html")?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 22nd, 2003, 7:25 pm

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post July 22nd, 2003, 10:57 pm

Yes right above that Limit block you can put lines like this to handle many different kind of things:


ErrorDocument 500 /error-pages/500.html
ErrorDocument 403 /error-pages/403.html
ErrorDocument 401 /error-pages/401.html
ErrorDocument 404 /error-pages/missing.html

or you can use the full domain using something like:

ErrorDocument 403 http://www.yourdomain.com/error.html

The one that is important in your case is the line with 403. The HTTP Response code 403 means Forbidden, and you can redirect all 403 errors to whatever page you want using something like above.
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post July 22nd, 2003, 11:00 pm

Keep in mind that if you ban a certain IP from your root directory on your domain then the user wouldn't even be able to access the 403 page that you redirect to. In that case it might work best if you redirect to another domain competely with the custom 403.html page made. If you are only blocking IP's from certain directories on your domain, then you could redirect all 403 errors to a directory/page on your site that isn't effected by the banning of the IP. Hope that makes sense.
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Dream4Muse
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 22, 2003
  • Posts: 18
  • Status: Offline

Post July 23rd, 2003, 11:58 am

I'm testing the code out on my own IP address first, and the error message it is giving me is "500 Internal Server Error" - could this have something to do with it not getting to my error document that is on a different domain? I tried using the ErrorDocument 500 line, but that did not work either.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post July 23rd, 2003, 12:03 pm

Are you placing this in your .htaccess file? or your httpd.conf file? Goto your server logs and see exactly what the error is saying so you know what is going on.
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Dream4Muse
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 22, 2003
  • Posts: 18
  • Status: Offline

Post July 23rd, 2003, 12:09 pm

I placed it in my .htaccess file since that was the original instruction for the code - should it be in my httpd.conf file instead?
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post July 23rd, 2003, 12:13 pm

I usually place it in my .htaccess file. You need to look at your error logs and see if what you put in your .htaccess file is producing errors. Sometimes you will need to adjust settings in your httpd.conf file before you can use certain directives in your .htaccess files. So look at your error_log and see if that explains anymore.
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Dream4Muse
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 22, 2003
  • Posts: 18
  • Status: Offline

Post July 23rd, 2003, 12:28 pm

I'm not sure if I quite understand what you're talking about. I do know that error message I'm getting came up as soon as I made the .htaccess file and put that code in it - even without the extra line to direct to an error page.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post July 23rd, 2003, 12:45 pm

Look in your error_log file. Usually its located at:

/var/log/httpd/error_log

and see what it is specifically saying about your .htaccess file. When you goto your page through your web browser all you get is 500 Internal Server Error. That is not telling you what is causing the problem. You need specifics or its pretty much guessing in the dark.
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Dream4Muse
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 22, 2003
  • Posts: 18
  • Status: Offline

Post July 23rd, 2003, 3:28 pm

I've gone through the error log and changed some things that were wonky and I'm still getting the error message. Would the code be different if I wanted to block someone from a specific page instead of the entire domain? Because of the setup of the site, blocking an IP address from accessing the mainpage will still do the trick.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post July 23rd, 2003, 5:56 pm

Was there anything in the error log complaining about stuff that was in your .htaccess file?
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Dream4Muse
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 22, 2003
  • Posts: 18
  • Status: Offline

Post July 23rd, 2003, 7:10 pm

If what I was looking at actually was the error log, it didn't say anything about stuff in the .htaccess file.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post July 23rd, 2003, 8:43 pm

Did it say anything about the Limit directive? or Error document directive? or any other complaints about directives?
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Dream4Muse
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 22, 2003
  • Posts: 18
  • Status: Offline

Post July 24th, 2003, 5:50 am

No it didn't, so I'm guessing that it wasn't the error log that I was seeing.
  • Dream4Muse
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 22, 2003
  • Posts: 18
  • Status: Offline

Post July 24th, 2003, 5:44 pm

Where am I supposed to be putting "/var/log/httpd/error_log" to find the error log? After my website address or in my FTP software?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 24th, 2003, 5:44 pm

Post Information

  • Total Posts in this topic: 35 posts
  • Users browsing this forum: No registered users and 132 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.