corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » Hotlink protection


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author Hotlink protection
Sam
Moderator
Premium Member


Registered: 24th Dec 99
Location: West Midlands
User status: Offline
19th May 12 at 16:26   View User's Profile U2U Member Reply With Quote

If I only want a certain domain to be able to hotlink to any images, how do I do this? htaccess?
Brett
Premium Member

Avatar

Registered: 16th Dec 02
Location: Manchester
User status: Offline
19th May 12 at 17:13   View Garage View User's Profile U2U Member Reply With Quote

You not using cpanel Sam? Has options for exclusions
Sam
Moderator
Premium Member


Registered: 24th Dec 99
Location: West Midlands
User status: Offline
19th May 12 at 19:31   View User's Profile U2U Member Reply With Quote

Oh yeah forgot about cPanel!

Will go check it out now!
Dom
Member

Registered: 13th Sep 03
User status: Offline
20th May 12 at 13:50   View User's Profile U2U Member Reply With Quote

htaccess -
code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ www.domain.com/blockedimage.png [NC,R,L]



Edit - IIRC the cPanel functions just generates rewrite rules anyway.

[Edited on 20-05-2012 by Dom]
Sam
Moderator
Premium Member


Registered: 24th Dec 99
Location: West Midlands
User status: Offline
20th May 12 at 14:02   View User's Profile U2U Member Reply With Quote

I can do it through cPanel as Brett points out, but the problem I now face is that I essentially want to block any sites except eBay from linking to images (as I've got an eBay shop set up).

I say it's a problem but not in a technical sense - I need to find out if there's a list of eBay domains/subdomains that I could copy and paste as the hotlink protection doesn't allow wildcard domains as far as I can see (i.e. I tried it and it didn't work).
Dom
Member

Registered: 13th Sep 03
User status: Offline
20th May 12 at 14:19   View User's Profile U2U Member Reply With Quote

I suspect they'll be *.ebay.* based, so just wildcard it.

For wildcard, iirc, replace -
code:
(www\.)?

with
code:
([^.]+)\.


And if you need to do wildcard on the TLD, you should be able to use -
code:
domain\.(.*) or domain.*



* Been a while since i've written rewrite rules so apologies if some of it is incorrect

Edit - Something like
code:
^http(s)?://([^.]+)\.ebay\.(com|co.uk|net|org)

Although if it won't match if there isn't a subdomain (www or other).

[Edited on 20-05-2012 by Dom]

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
how do i show a pic of my car eel General Chat 6 754
28th Oct 06 at 10:37
by AndyCorsaSport
 
What wheels are these ? SteveW General Chat 30 674
2nd Feb 07 at 20:51
by VegasPhil
 
Looking after an engine Sunz Help Zone, Modification and ICE Advice 3 315
9th Aug 07 at 14:13
by Sunz
 
When applying for a loan extension RyanSxi House Day 14 983
23rd Jan 08 at 21:27
by Twiggy
 
Picture hosting sites deano87 Snap Day 49 479
11th Nov 08 at 22:16
by deano87
 

Corsa Sport » Message Board » Off Day » Geek Day » Hotlink protection 28 database queries in 0.0128229 seconds