disable no hotlinking in a certain folder

New to mod_rewrite? This is a good place to start.

disable no hotlinking in a certain folder

Postby rufuz » Sun Aug 09, 2009 3:56 pm

as in title, I got this idea to face the problem of sending newsletter with images from my domain.

I added some exceptions for some domains but I can't add all email domains of my subscribers.
Unfortunately I can't even move images in an other domain or subdomain: I use feedburner and it retrieves the first image of each article, in my domain.

Code: Select all
#no-hotlinking + exceptions (feedburner)
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mydomain\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://feeds2.feedburner.com/mydomain$ [NC]
RewriteCond %{HTTP_REFERER} !^http://feeds2.feedburner.com/~r/mydomain/~6/5$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.feedburner.com/.*$ [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ images/nohotlink.jpg [L]


So I wonder if there's a better solution of putting first images in an unprotected folder and, if not, how to specify a hotlink-free folder?

thanks Richard!

ricc.
rufuz
 
Posts: 16
Joined: Thu Aug 21, 2008 9:56 am

Postby richardk » Wed Aug 12, 2009 11:42 am

Code: Select all
RewriteCond %{REQUEST_URI} !^/directory(/.*)?$
Code: Select all
RewriteCond %{REQUEST_URI} !^/dir1/dir2(/.*)?$


Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/directory(/.*)?$
RewriteCond %{HTTP_REFERER} !^(http://(.+\.)?example\.com(/.*)?)?$ [NC]
RewriteCond %{HTTP_REFERER} !^http://feeds2\.feedburner\.com/(~r/mydomain/~6/5|mydomain)$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www\.feedburner\.com(/.*)?$ [NC]
RewriteRule .\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby rufuz » Thu Aug 13, 2009 6:47 am

Thanks! I will try asap!

ricc.
rufuz
 
Posts: 16
Joined: Thu Aug 21, 2008 9:56 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 29 guests

cron