Need Help With htaccess !! , been having trouble since a long time

Discussion in 'Apache' started by procrastinator, May 18, 2007.

  1. #1
    this is my htacces file

    ive been having trouble with lots of people unable to see the full images (they instead see the image which i use when people try to hotlink) , they can see the thumbnails though.

    [​IMG]

    Im really out of clue , & the site is really going down :(

    Would really like help on this one , willing to give a liftime link in the partners to anyone who will help sort this out for me.
     
    procrastinator, May 18, 2007 IP
  2. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Your rewrite code prevents anyone from viewing any image (other than images from the thumbs directory) if they have not sent a referrer that matches your domain.

    The referrer is an optional header that most browsers send which contains the URL of the referring page.. but you absolutely cannot rely on it to block access, or worse (as in this case) grant access - it may not be sent at all, or can be set to anything by the user. There's even an extension for Firefox that allows you to choose what to send as the referrer.

    If you want it to work for everyone, you need to remove your rewrite rules. You can improve it slightly though by also checking the referrer is not empty - so rather than saying "If referrer is not my domain, block", you're saying "If referrer is sent and is not my domain, block":
    RewriteEngine on
    RewriteCond %{REQUEST_URI} ^/images/thumbs/
    RewriteRule .* - [L]
    
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://www.imagepundit.com/? [NC]
    RewriteRule \.(jpg|jpeg|gif|png|bmp)$ http://xs215.xs.to/xs215/07204/mugdhagodse.jpg [R,NC]
    Code (markup):
     
    rodney88, May 18, 2007 IP
  3. evera

    evera Peon

    Messages:
    283
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Another alternative is with mod_setenvif, eventhough the option of serving an alternate image can't be supported by these modules, it does exactly the same.
    <FilesMatch "\.(gif¦jpe?g¦png¦bmp)$"> 
    SetEnvIfNoCase Referer ^$ allow_image 
    SetEnvIfNoCase Referer ^http://(www\.)?imagepundit\.com allow_image 
    Order Deny,Allow 
    Deny from all 
    Allow from allow_image 
    </FilesMatch>
    Code (markup):
     
    evera, May 18, 2007 IP
  4. procrastinator

    procrastinator Peon

    Messages:
    1,718
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Works well !!! :D
    glype.com link is live under partners, lemme know if you want something else or change of text.

     
    procrastinator, May 19, 2007 IP