Apache Server configuration support - Blocking Hotlinking and illegal referrals

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > March 2005 > Blocking Hotlinking and illegal referrals





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Blocking Hotlinking and illegal referrals
NeoPhreak

2005-03-26, 6:06 pm

Okay, I'm tryng to block hotlinking to my site from unwanted referrals.

I have a .htaccess file placed in the directory I want to block.
Here's what the file would look like:

RewriteEngine on
RewriteCond %{HTTP_REFERER} ^$
RewriteCond %{HTTP_REFERER}
^http://(www\.)?thedomainIwanttobockhere.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|htm|php|html|css)$
http://thepageIwanttoredirectto.com/here [R,NC]

Simple enough.

Now when I place it in the directory it has no effect, Soooo i head on over
to my httpd.conf file and check the directive.
Of course its set to AllowOverride None

Looks something like this:

<Directory "/var/www/whatever">
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Now when I change AllowOverride to All I get access forbidden when trying to
browse that directory from anywhere, even on the localhost. I've tried
changing it to other settings like FileInfo, AuthConfig and Limit just to
play around with it, and all of them give me the forbidden error.

Now the main site has AllowOverride set to none, but I read some of the
apache docs and my impression is that the main site can be set to none and
the independant directives that are declared will not inherit that if they
have another setting defined.

Anyone have any Ideas, or know where I'm going wrong here?

Thanks for any help in advance

>.< NeoPhreak



HansH

2005-03-26, 6:06 pm

"NeoPhreak" <blah@blah.com> schreef in bericht
news:aPk1e.40395$nK.1807550@news20.bellglobal.com...
> Okay, I'm tryng to block hotlinking to my site from unwanted referrals.
> I have a .htaccess file placed in the directory I want to block.
> Here's what the file would look like:
> RewriteEngine on
> RewriteCond %{HTTP_REFERER} ^$
> RewriteCond %{HTTP_REFERER}
> ^http://(www\.)?thedomainIwanttobockhere.com(/)?.*$ [NC]
> RewriteRule .*\.(gif|jpg|jpeg|bmp|htm|php|html|css)$
> http://thepageIwanttoredirectto.com/here [R,NC]
>
> Simple enough.
> Anyone have any Ideas, or know where I'm going wrong here?

BOTH conditions cannot be true at any one time...
.... remove the first condition and try again.

More commonly used is a pair of lines like
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?your_domain\.com/

HansH


HansH

2005-03-30, 6:03 pm

"NeoPhreak" <blah@blah.com> schreef in bericht
news:aPk1e.40395$nK.1807550@news20.bellglobal.com...
> Okay, I'm tryng to block hotlinking to my site from unwanted referrals.
> I have a .htaccess file placed in the directory I want to block.
> Here's what the file would look like:
> RewriteEngine on
> RewriteCond %{HTTP_REFERER} ^$
> RewriteCond %{HTTP_REFERER}
> ^http://(www\.)?thedomainIwanttobockhere.com(/)?.*$ [NC]
> RewriteRule .*\.(gif|jpg|jpeg|bmp|htm|php|html|css)$
> http://thepageIwanttoredirectto.com/here [R,NC]
>
> Simple enough.
> Anyone have any Ideas, or know where I'm going wrong here?

BOTH conditions cannot be true at any one time...
.... remove the first condition and try again.

More commonly used is a pair of lines like
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?your_domain\.com/

HansH


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com