Results 1 to 2 of 2
  1. #1
    Mike Mike's Avatar
    Join Date
    Dec 2004
    Location
    Rosarito, Mexico
    Posts
    1,396

    Default htaccess hotlinking

    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)
    Code:
    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.
    what are you doing looking in here?

  2. #2
    Correct my English!
    Join Date
    Feb 2005
    Location
    Cycling somewhere
    Posts
    6,292

    Default Re: htaccess hotlinking

    *bump*

    Free, 24/7 telephone health advice service | Healthline - 0800 611 116

    Smoking KILLS. Don't let your life be ruled by cigarettes. | Quitline - 0800 778 778 ‎

    Join the unofficial PressF1 WCG team!



Similar Threads

  1. htaccess/htpassword timeout
    By teszeract in forum PressF1
    Replies: 4
    Last Post: 31-03-2006, 11:25 AM
  2. Replies: 1
    Last Post: 12-12-2003, 12:43 PM
  3. Deleting folders with a .htaccess file in them
    By somebody in forum PressF1
    Replies: 1
    Last Post: 24-08-2003, 03:50 PM
  4. .htaccess and .htpasswd files
    By superOman in forum PressF1
    Replies: 6
    Last Post: 25-09-2002, 06:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •