|
|
|
|
|
|
|
![]() |
#1 |
ICQ:147*079*406
|
htaccess/hotlinking for WP
Was hoping to find an easy way to hotlink protect my blog(s) from a few domains..with the ability to add more if needed and then in turn sending that traffic to a url of my choice.
Thanks in advance.
__________________
The Sexy Side of Porn |
![]() |
![]() |
![]() |
#2 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
There are two ways to do it.
1) Block everything unless you specifically allow it -- this probably doesn't play well with the nature of blogs, but, the code would be: Code:
RewriteEngine on # leave this line in allow empty referrers, remove to disallow empty referrers RewriteCond %{HTTP_REFERER} !^$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.*@)?([a-z0-9-]+\.)*yourdomain\.com(:[0-9]+)?(/.*)?$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.*@)?([a-z0-9-]+\.)*yourseconddomain\.com(:[0-9]+)?(/.*)?$ [NC] RewriteRule .*\.(asf|mpg|mpeg|wmv|avi|rm|gif|jpeg|jpg|png|zip)$ - [NC,F,L] Code:
RewriteEngine on # leave this line in allow empty referrers, remove to disallow empty referrers RewriteCond %{HTTP_REFERER} !^$ [NC] RewriteCond %{HTTP_REFERER} !^http://(.*@)?([a-z0-9-]+\.)*(yourdomain\.com|yourseconddomain\.com)(:[0-9]+)?(/.*)?$ [NC] RewriteRule .*\.(asf|mpg|mpeg|wmv|avi|rm|gif|jpeg|jpg|png|zip)$ - [NC,F,L] Code:
RewriteEngine on RewriteCond %{HTTP_REFERER} hotmail|google [NC] RewriteRule .* http://url.to/go/to.html [F,L]
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#3 |
You can now put whatever you want in this space :)
Join Date: Nov 2006
Location: Vulcan
Posts: 695
|
Does this always work , I am getting a ton of traffic from asktiava which I want to redirect , I have this code in my htaccess:
Code:
RewriteEngine on RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?sex4free.co.il/heb_htm/cat/babes.htm/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?fode-me.com/.*$ [NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?http://www.buterbrod.com/.$[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?http://www.superzeta.it/.$[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?http://www.sexonabanheira.com/.$[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?http://80.64.8.170/.$[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?http://www.ananasik.com/.$[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?http://www.asktiava.com/search/.$[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?http://www.iij4u.or.jp/.$[NC,OR] RewriteRule .* http://www.avoidhomeforeclosureblog.com [R,L] order allow,deny deny from 89.18.179.48 allow from all ![]() Last edited by Mr Spock; 2008-12-15 at 11:51 AM.. |
![]() |
![]() |
![]() |
#4 |
ICQ:147*079*406
|
Thanks for the reply CD - so to block out one domain (at the time being) Coudl I set up htaccess like this?
Code:
RewriteEngine on RewriteCond %{HTTP_REFERER} badsite\.com [NC] RewriteRule .* http://url.to/go/to.html [F,L]
__________________
The Sexy Side of Porn |
![]() |
![]() |
![]() |
#5 |
ICQ:147*079*406
|
Mr Spock, Im not a code guru or anything but it appears with your example, you're adding the http and the www twice? maybe remove the "http://www." from the domain string and see if that works? Perhaps only use the "asktiava.com/search/" part.
__________________
The Sexy Side of Porn |
![]() |
![]() |
![]() |
#6 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
Yes NY Jester, that snippet would work for banning 1 domain.
Code:
RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?http://www.asktiava.com/search/.$[NC,OR] as NY Jester says: Code:
RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?asktiava.com/search/[NC,OR]
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#7 | |
You can now put whatever you want in this space :)
Join Date: Nov 2006
Location: Vulcan
Posts: 695
|
Quote:
|
|
![]() |
![]() |
![]() |
#8 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
Are you sure your .htaccess is being parsed? what is a url on that other site that is supposed to redirect based on your rule?
can you give me the query you use from the remote site? perhaps something in the url or the way they pass it to your site is erasing the referrer.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#9 |
You can now put whatever you want in this space :)
Join Date: Nov 2006
Location: Vulcan
Posts: 695
|
This is the search query on asktiava.com:
http://www.asktiava.com/search/?p=10...awna+lenee&nc= If I click on this link to my site it doesn't redirect like it should. http://www.myfree-porn.com/free-gall...-ibp/free.html Here is the contents of my htaccess: Code:
AddType php-cgi .html .htm RewriteEngine on RewriteCond %{HTTP:Accept-Language} (zh) [NC] RewriteRule .* http://www.avoidhomeforeclosureblog.com [R,L] RewriteEngine on RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?sex4free.co.il/heb_htm/cat/babes.htm/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?fode-me.com/.*$ [NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?buterbrod.com/.$[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?superzeta.it/.$[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?sexonabanheira.com/.$[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?80.64.8.170/.$[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?ananasik.com/[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?asktiava.com/search/[NC,OR] RewriteCond %(HTTP_REFERER) ^http(s)?://(www\.)?iij4u.or.jp/[NC,OR] RewriteRule .* http://www.avoidhomeforeclosureblog.com [R,L] order allow,deny deny from 89.18.179.48 allow from all |
![]() |
![]() |
![]() |
#10 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
do you have any .htaccess files down below the one in your top directory?
if so, do they contain: RewriteOptions inherit in them? If they don't, they replace the existing rewrite rules also, your rules that end with .$ won't match much of anything -- you need them to either be .*$ or remove the .$ at the end.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#11 |
You can now put whatever you want in this space :)
Join Date: Nov 2006
Location: Vulcan
Posts: 695
|
I changed the htaccess using the coding you gave Nyjester as follows
Code:
RewriteEngine on RewriteCond %{HTTP_REFERER} asktiava.com [NC] RewriteRule .* http://avoidhomeforeclosureblog.com [F,L] ![]() What do I need to change to direct it to http://avoidhomeforeclosureblog.com |
![]() |
![]() |
![]() |
|
|