Sam
Moderator Premium Member
Registered: 24th Dec 99
Location: West Midlands
User status: Offline
|
If I only want a certain domain to be able to hotlink to any images, how do I do this? htaccess?
|
Brett
Premium Member
Registered: 16th Dec 02
Location: Manchester
User status: Offline
|
You not using cpanel Sam? Has options for exclusions
|
Sam
Moderator Premium Member
Registered: 24th Dec 99
Location: West Midlands
User status: Offline
|
Oh yeah forgot about cPanel!
Will go check it out now!
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
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
|
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
|
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]
|