Forum Moderators: phranque
# -FrontPage-
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
#The next line modified by DenyIP
order allow,deny
#The next line modified by DenyIP
#deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.example.com
AuthUserFile /home/example1/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/example1/public_html/_vti_pvt/service.grp
<Files 403.shtml>
order allow,deny
allow from all
</Files>
What I want to know is if this code (below) that I found on this site will work to deny access to my website from an outside website that has linked and will not remove their link. I also need to know just where to put this code in the orignal code. Could someone please help?
SetEnvIf Referer ^http://.*\badsite\.com ban
<Files *>
order deny,allow
deny from env=ban
</Files>
Thaks,
J4T
Welcome to WebmasterWorld [webmasterworld.com]!
Things tend to be quieter back here than "up front" in places like the Google forum. It might take 24-48 hours to get an authoritative answer.
In the comments of your code, it mentions "modified by DenyIP" twice. What is DenyIp? If you modify those lines, will "DenyIP" come back and change them again?
Basically, I see some problems, but if this is a script that is going to come back and re-write your existing code, then no fix I might post is going to work.
The answer to your basic question is easy, but the above is a major concern, because from what I have experienced, only ONE Order statement can appear in an .htaccess file, and the one you have is opposite what is needed to fix your problem, AND if we fix it, it might get overwritten by this mysterious DenyIP.
Therefore, the question is bigger than it appears.
Jim
It is now
# -FrontPage-
IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
order deny,allow
deny from all
allow from all
order deny,allow
deny from all
AuthName www.example.com
AuthUserFile /home/example1/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/example1/public_html/_vti_pvt/service.grp
order allow,deny
allow from all
Ok to the above where do I put the code to deny access from a particular website?
Thanks
J4T
Your edited code will not work because you have more than one Order, as explained by Jim, however it is possible to use more than one Order provided that they are put inside different <Limit> directives.
Your edited code could also wreck FrontPage extensions, if you use them and mod_rewrite will not work with FP extensions.
SetEnvIf Referer ^http://.*\badsite\.com ban
For example it will match the following
www.#adsite.com
www. adsite.com
Use the following
SetEnvIf Referer ^http://(www\.)?badsite\.com ban
<Files *>
order deny,allow
deny from env=ban
</Files>
Regular expressions should be used in <FilesMatch> directive. You don't need to use <Files> or <FilesMatch> directives to stop badsite.com from hotlinking.
==========================================
The following should work without wrecking FrontPage extensions
# -FrontPage-IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*
SetEnvIfNoCase Referer ^http://(www\.)?badsite\.com ban
# Put banned IPs in <Limit GET POST> below deny from env-ban
# eg. deny from 123.45.67.89<Limit GET POST>
order allow,deny
allow from all
deny from env=ban
</Limit><Limit PUT DELETE>
order deny,allow
deny from all
</Limit>AuthName www.example.com
AuthUserFile /home/example1/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/example1/public_html/_vti_pvt/service.grp