Forum Home
Press F1
 
Thread ID: 85355 2007-12-07 20:08:00 htaccess hotlinking Mike (15) Press F1
Post ID Timestamp Content User
618794 2007-12-07 20:08:00 I have set up in my .htaccess to block hotlinking to images except from specific domains, and except to a specific subfolder on my website. However this subfolder is also used as a subdomain, and my code isn't working for the subdomain (while it does work on the subfolder)

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/p
RewriteRule ^.*$ - [L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png)$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !example\.com [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule (.*) /l?/$1 [R,NC,L]So basically I'm blocking hotlinking from anywhere but my domain, except to the subfolder "/p" - anywhere can hotlink to that subfolder. But if a site hotlinks to the subdomain "p" (eg p.example.com) the hotlink is broken.

And ideas on how to allow hotlinks to that subdomain?

Cheers,
Mike.
Mike (15)
618795 2007-12-10 00:02:00 *bump* Renmoo (66)
1