Little mod_rewrite help with image hotlinking

Discussion in 'Apache' started by gaussian, Mar 19, 2008.

  1. #1
    OK here's my problem.

    I'm trying to get a problem with image hotlinking under control. What I'd like is to allow linking to thumbnails but only allow the fullsize images to be served via another page.

    What I'd like is to allow all request to /thumbs/(1-99)/*.jpg but redirect all calls to uploads/(1-99)/*.jpg to view_image.php while allowing all calls to any other existing php page on the site.

    I thought it would be something like this but I've tried many variation on the standard denying hotlinking .htaccess scripts I've got and they work to a point but I can't seem to combine them to perform the above?


    Can someone please put me out of my misery or point me to a good mod_rewrite tutorial!!!

    RewriteCond %{REQUEST_FILENAME} uploads/(.*)/(.*)\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{HTTP_REFERER} !^mysite.com$
    RewriteRule (.*) /view_image.php?/$1 [R,NC,L]
     
    gaussian, Mar 19, 2008 IP
  2. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #2
    I don't understand what you are trying to do :(
     
    buldozerceto, Mar 19, 2008 IP
  3. gaussian

    gaussian Peon

    Messages:
    151
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Basically, I want to allow hotlinking from one directory but redirect all calls to images in other directories via a php page.
     
    gaussian, Mar 20, 2008 IP