Forum Moderators: phranque
I've recently had some problems with certain IP addresses stealing content from my website. I have been trying to find a way to block these 3 IP addresses (and only those 3 addresses) from accessing my site.
I know there has to be a way to install a custom 403 FORBIDDEN page that will block them access to my site, but I can't find any "How-To" links online anywhere (and oddly enough, my webhost service doesn't offer the service)
Anyone have any advice? I would really appreciate it...
Matt
aka Iron-Cow
[edited by: jatar_k at 5:54 pm (utc) on Sep. 1, 2005]
[edit reason] no sigs thanks [/edit]
I just save it as htaccess (no dot), then rename it after it's uploaded to my server?
Any other info I need to include in there?
Also, the "allow from all" ... that basically means anyone, everyone can still see the site, except for the IP's listed under "deny" right?
I *really* appreciate the help, by the way!
Matt
aka Iron-Cow
[edited by: jatar_k at 5:55 pm (utc) on Sep. 1, 2005]
[edit reason] no sigs thanks [/edit]
It will only work if the OS of the server is Unix or Linux.
Be sure to check that you don't overwrite some .htaccess file that happens to exist already in that directory and serves an important function.
Also be sure to test your site once you've uploaded the file. Screw up this file and your site can stop working. If do you run into a problem, just delete the file and the problem will go away.
One more little "gotcha"... This shouldn't happen but it's possible that your FTP client won't display "system" files (i.e. any file beginning with a period) by default. Thus when you copy the file over it will be invisible. (The reason I mention this is that command line functions don't display system files by default.) Anyway, if the file is invisible but you need to view or delete it for some reason, check your FTP client settings.
I did a guinnea pig test on a friend of mine. Used his IP address, uploaded the txt file, then renamed it. (and you're right, it disappeared once it was renamed!)
He was instantly forbidden through all parts of my site. So, then I deleted his IP address, added in the offending ones, resaved/reuploaded and my buddy had instant access again.
Works GREAT!
Man, I owe you guys like crazy! I *REALLY* appreciate it. Like you wouldn't believe!
Thanks again... you guys rock!
Matt
aka Iron-Cow
[edited by: Brett_Tabke at 5:54 pm (utc) on Sep. 1, 2005]
[edit reason] no sigs -please... [/edit]
I believe if you check again, you'll find that it depends on the web server being NCSA-compatible, not the operating system. If you're running Apache on Windows, it will work.
Be sure to check that you don't overwrite some .htaccess file that happens to exist already in that directory and serves an important function.
An added note: if there's already an .htaccess file there, you normally can just add any extra directives you need.