Random Linux

Linux, video games and web hosting

You are able to deny or allow all or selected IP addresses or ranges using the .htaccess file. Edit it with any text editor and add this code deny all IP addresses from viewing a site or folder.

order allow,deny
deny from all

You can also deny a range of IPs or one particular IP by adding the allow from directive in. The first example will allow all IPs except for 123.456.6.83.

order allow,deny
deny from 123.456.6.83
allow from all

And this will deny all IPs from the 123.456.xxx.xxx range.

order allow,deny
deny from 123.456
allow from all

Also, you can deny all IPs and only allow certain ones to access the folder. To allow only 123.456.6.83 to access the site, you can use the deny all along with an allow directive.

order allow,deny
deny from all
allow from 123.456.6.83

And for a range, you can also use the same method

order allow,deny
deny from all
allow from 123.456

January 17th, 2011

Posted In: Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *

*