.htaccess referer problem

Discussion in 'Programming' started by Mailzas, Dec 19, 2007.

  1. #1
    I am trying to pass referer info to a script. However my code does not work. It gives referer, as jpg file. How to fix that?


    RewriteEngine On
    
    RewriteRule ^([A-Za-z/0-9-]+)\.png$ http://www.heyimage.com/script.php?img=$1&type=png&ref=%{HTTP_REFERER} [L,NS]
    RewriteRule ^([A-Za-z/0-9-]+)\.jpg$ http://www.heyimage.com/script.php?img=$1&type=jpg&ref=%{HTTP_REFERER} [L,NS]
    RewriteRule ^([A-Za-z/0-9-]+)\.gif$ http://www.heyimage.com/script.php?img=$1&type=gif&ref=%{HTTP_REFERER} [L,NS]
    Code (markup):
     
    Mailzas, Dec 19, 2007 IP
  2. lephron

    lephron Active Member

    Messages:
    204
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    it will never match your regular expression. Try without the ^ on the rules
     
    lephron, Dec 19, 2007 IP