Post by sytra » Tue Jul 22, 2014 5:38 am

Hi

I am hoping someone can offer a suggestion that works, we have a couple of images that have been hotlinked, while 1 is essential and 1 has credited the image to us there is a third one that has 3 of our images and they are on a dodgy site which points to porn.

We have tried adding (and others) the following code to the .htaccess file:

Code: Select all

RewriteCond %{HTTP_REFERER} !^http://(.+\.)?xxxxxxx\.xx\.xx/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteCond %{HTTP_REFERER} !msn\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png|jpg)$ /image/data/nohotlink.jpe [L]
This doesn't seem to work and also breaks the admin panel and the "nohotlink" image shows through on the store front

We do have crawltrack and crawlprotect but this still seems to allow hotlinking

Running OC 1.5.5.1 with vqmods.
http://www.aislings.co.uk
http://www.lovers-paradise-toys.co.uk


Active Member

Posts

Joined
Sat Feb 04, 2012 6:27 am

Post by sytra » Wed Jul 23, 2014 12:26 am

Ok, think i have figured it out, I saw there was a .htaccess file in the image folder so I added the following code and it seems to work. (originally I tried adding the code to the main htaccess file)

Code: Select all

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?xxxxxx.co.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://(www.)?xxxxxx.co.uk/xxxxx/.*$ [NC]
RewriteCond %{HTTP_REFERER} !google. [NC]
RewriteCond %{HTTP_REFERER} !search?q=cache [NC]
RewriteCond %{HTTP_REFERER} !msn. [NC]
RewriteCond %{HTTP_REFERER} !yahoo. [NC]
RewriteCond %{REQUEST_URI} !^/pages/images/
RewriteRule .*.(gif|jpg|jpeg|png|ico)$ http://www.xxxxxxxx.co.uk/image/data/nohotlink.jpe [R,NC,L]
The first referer is the front end, the second is the admin panel, at least now the admin panel seems to work.

Can anyone see any reason why this shouldn't work or is it the wrong way to go about it.

Running OC 1.5.5.1 with vqmods.
http://www.aislings.co.uk
http://www.lovers-paradise-toys.co.uk


Active Member

Posts

Joined
Sat Feb 04, 2012 6:27 am

Post by pprmkr » Wed Jul 23, 2014 12:51 am

Edit .htaccess
After last RewriteRule add:

Code: Select all

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?YOUR_URL.DOMAIN [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?YOUR_URL.DOMAIN/ADMIN [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ URL_TO_IMAGE [NC,R,L]
Where:
- YOUR_URL.DOMAIN = url without www.
- URL_TO_IMAGE = full url to image to show. NOTE: Cannot be on the same server !

All images from YOUR_URL.DOMAIN will be replaced by URL_TO_IMAGE when referer is not YOUR_URL.DOMAIN or YOUR_URL.DOMAIN/ADMIN

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands
Who is online

Users browsing this forum: No registered users and 75 guests