Help Please

Discussion in 'HTML & Website Design' started by qardinal, Jul 16, 2007.

  1. #1
    is there a way i can modify my .htaccess file to exclude hotlinking for certain images in a file, but include others? what i mean is, i have a folder that contains all of my images, and the thumbnails have "_th" in the file name (ex: 289452_th.jpg). the large pics don't have the "_th" in the filename (ex: 289452.jpg).

    can i modify my .htaccess where it allows hotlinking for all files with the "_th", but disallows it for all files without the "_th"? +rep to anyone who can help me out. thanks.
     
    qardinal, Jul 16, 2007 IP
  2. eadkung

    eadkung Active Member

    Messages:
    148
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    You may try this,

    RewriteEngine On
    RewriteBase /
    RewriteRule ^(.*)_th\.(jpe?g|gif|bmp|png)$ - [F]
    
    Code (markup):
    when imageName_th.jpg is hotlinked from other site, it shows nothing.
    This is not effect with no '_th' images.:)
     
    eadkung, Jul 16, 2007 IP
    qardinal likes this.
  3. qardinal

    qardinal Peon

    Messages:
    333
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for your feedback, but i need the images with _th to be able to be hotlinked. i have a photo hosting site, and i need the images without the _th to not be hotlinked.
     
    qardinal, Jul 17, 2007 IP
  4. eadkung

    eadkung Active Member

    Messages:
    148
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #4
    oh sorry, i didn't read your request clearly. :eek:

    what you want is to:

    Allow: 289452_th.jpg
    Disallow: 289452.jpg

    so, rewrite code should be like this:
    RewriteEngine On
    RewriteBase /
    RewriteRule ^.*[^(_th)]\.(jpe?g|gif|bmp|png)$ - [F]
    
    Code (markup):
    sorry for miss reading, this might help. :)
     
    eadkung, Jul 17, 2007 IP
  5. skibladner

    skibladner Peon

    Messages:
    1,149
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #5
    or just put the thumbnails in a different directory
     
    skibladner, Jul 17, 2007 IP
  6. web_mehul

    web_mehul Banned

    Messages:
    248
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    separate the thumbnail images into the other directory.

    That's the only best way to get secure.
     
    web_mehul, Jul 17, 2007 IP
  7. qardinal

    qardinal Peon

    Messages:
    333
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #7
    i can't separate the thumbnails because i'm running an image hosting script that places them in the same directory. ead i'm going to try what you just suggested
     
    qardinal, Jul 18, 2007 IP
  8. qardinal

    qardinal Peon

    Messages:
    333
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #8
    ok i tried it, and it's working PERFECTLY. i hope good things happen to you eadkung because you really helped me out of a jam. people were starting to hotlink 1mg image files like crazy. thanks a LOT
     
    qardinal, Jul 18, 2007 IP
  9. eadkung

    eadkung Active Member

    Messages:
    148
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #9
    you're welcome :)
     
    eadkung, Jul 18, 2007 IP