It is currently Thu Mar 28, 2024 9:14 am


All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [.htaccess] Ban an IP using .htaccess
PostPosted: Thu May 18, 2006 8:35 am 
Site Admin
Site Admin

Joined: Fri Feb 11, 2005 7:43 am
Posts: 1818
Location: 100WebSpace's Headquarters
Here is how you can ban the access of certain IPs to your website using .htaccess:

Create an .htaccess file in the folder of your subdomain/domain and add the following lines to it (or add the lines to your existing .htaccess file):

Code:
order allow,deny
deny from 127.0.0.1
allow from all


Of course you should replace 127.0.0.1 with the IP that you want to ban.

If you want to ban more than one IP, just add a new line:

Code:
deny from 127.0.0.2


If you want to ban a whole IP range like this:

Code:
deny from 127.0.0


This will refuse access for any user with an address in the 127.0.0.0 to 127.0.0.255 range.

_________________
Read the F.A.Q. before asking a question!


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 11:26 pm 
I have no life!
I have no life!

Joined: Sun Feb 13, 2005 6:12 pm
Posts: 1504
Location: My Office
:D

_________________
Best Regards:
Aaron McGowan (aka: CyberGeek, =cipher=)

CyberGeek's Software Solutions
-- WWW: http://www.cybergeeksoftware.com
-- Tech Line: 1-519-860-4557
-- Email: cybergeek@cybergeeksoftware.com


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 20, 2006 1:37 am 
Nice, glad to see 100webspace has enabled more .htaccess support :)

Using mod_rewrite is awesome, I am going to use it for my site when I re-code it (Hopefully this summer) :)


Top
  
 
 Post subject:
PostPosted: Wed May 31, 2006 12:08 am 
I have no life!
I have no life!

Joined: Sun Feb 13, 2005 6:12 pm
Posts: 1504
Location: My Office
Greetings,

There are also a lot more then just banning IP addresses and directory index redirects to an .htaccess code. Here is one other small little tip that I do.

404 Error Document
- Create a .htaccess file, and insert the following code:
Code:
ErrorDocument 404 whatever/blah.php


- Now, change the whatever/blah.php to the file name of your 404 Error Page.
- This will code will make it so that if any user goes to a non-existing page, they will be redirected to your 404 error doc.
- I suggest doing this because having your 404 Error Document set in your SubDomain Manager located in your CPanel, sometimes causes errors within your site. I have experienced these errors, and it really sucks.

I hope this may help some other people too. :D

There is A LOT more you can do with .ht* files. I will post some more examples later.

_________________
Best Regards:
Aaron McGowan (aka: CyberGeek, =cipher=)

CyberGeek's Software Solutions
-- WWW: http://www.cybergeeksoftware.com
-- Tech Line: 1-519-860-4557
-- Email: cybergeek@cybergeeksoftware.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ]  Moderators: fhmagic, KJ, Moderators, Support Team

All times are UTC


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

Search for:
Jump to:  
100WebSpace © 2011