Blocked my country for .htaccess? - .htaccess

I have generated blocked some country list on ip2location for .htaccess file.Everything it's ok but if I blocked my country ,how can I access on my computer in my country? Do you have any idea for .htaccess settings?
<Limit GET HEAD POST>
order allow,deny
allow from all
deny from 1.0.1.0/24
deny from 1.0.2.0/23
deny from 1.0.8.0/21
</Limit>

Related

Allow certain IP ranges and googlebot, deny the rest, for certain URLs only

I need to modify and combine some .htaccess rules, in order to meet 3 separate conditions:
Allow access from certain IP ranges, deny the rest
Allow googlebot, no matter what IP
All this applies only to any URL containing 'theword'
<Directory "containing *theword*">
Order allow,deny
Deny from all
Allow from 192.168.0.2
Allow from 10.0.0.1
</Directory>
<Files "containing *theword*">
Order allow,deny
Deny from all
Allow from 192.168.0.2
Allow from 10.0.0.1
</Files>
I need help formatting rule with the files/directories containing theword and add exception for the googlebot.

How do I block IPs using htaccess

How can I stop these IP addresses from hitting my site (185...* and 93.127..).
I have tried these in .htaccess:
Order Allow,Deny
Deny from 185.162.0.0/15
Deny from 185.164.0.0/14
Deny from 185.168.0.0/13
Deny from 185.176.0.0/12
Deny from 185.192.0.0/11
Deny from 93.127.0.0/16
Allow from all
and bots from http://tab-studio.com/en/blocking-robots-on-your-page/ but I continue to be hit.
Good: Edit (or create) the .htaccess file in the root of your server and put the following code:
order allow, deny
deny from 210.140.98.160
deny from 69.197.132.70
deny from 74.14.13.236
allow from all

Directive allow from not work for only one ip in .htaccess

I have .htaccess file for wordpress. There is code
<Files wp-login.php>
order deny,allow
deny from all
allow from 46.61.xxx
allow from 91.211.xxx
allow from 176.14.xxx
</files>
2 of these ip - works, i.e. i can enter from 46.61.xxx and 176.14.xxx, but i can't enter from 91.211.xxx. What problem could it be?
Give it a try without those xxx's, check the apache documentation
<Files wp-login.php>
order deny,allow
deny from all
allow from 46.61
allow from 91.211
allow from 176.14
</files>

htaccess Deny All for certain files and allow by IP for the rest

I've recently upgraded a web app and I want to combine the new and old htaccess into one file. Here is my new htaccess:
<Files ~ "\.inc$">
Order allow,deny
Deny from all
</Files>
And my old htaccess:
order deny,allow
deny from all
Allow from 12.34.567.89
Allow from 12.34.567.88
My end goal is that No One can access the *.inc but only the approved IPs can access the rest of the folder.
Can I just concatenate these two rules in one file?
Yes you can use:
order deny,allow
deny from all
Allow from 12.34.567.89
Allow from 12.34.567.88
<Files ~ "\.inc$">
Order allow,deny
Deny from all
</Files>

What do these .htaccess commands do?

I'm creating a new website, so I'm creating a new .htaccess for it.
To get an example, I took a look at another website I have, and found the following code, among some other code, inside:
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
What is the purpose of these commands? should I implement them in my new site as well?
LIMIT defines what method(s) can be used.
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
order deny,allow will make the deny rule evaluated first, then it will evaluate the allow rule. The above, will tell it to deny access to everything, but then allow the GET and POST methods access everything. So that is basically useless.
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
The above will deny all PUT and DELETE methods.
This link can explain what GET, POST, PUT, and DELETE methods are in.
As for the IndexIgnore
The IndexIgnore directive adds to the list of files to hide when listing a directory. File is a shell-style wildcard expression or full filename. Multiple IndexIgnore directives add to the list, rather than the replacing the list of ignored files. By default, the list contains . (the current directory).
^Gotten from the Apache documents

Resources