Help with Modrewrite - Allowing Mozilla (Fire Fox)

Discussion in 'Apache' started by Mark_Sc, Jul 4, 2006.

  1. #1
    Hi guys,
    Ive been thrown into this Modrewrite over the last 2 weeks,
    and on a steep learning curve.
    I dont know FireFox at all.
    I use (IE 6) Which most of my visitors use.

    I have a htacess code to prevent hotlinking.
    But today a user informed me that he can not see the images
    with in my domain? Where he should be able to see them,
    unless he was veiwing images outside my domiain (website).

    Could someone advise / help me tweak my code,
    so that Fire Fox users can view the images with in my domain,
    but not as "Hotlinks" else where.

    My Server is using Apache/1.3.33 (Unix)

    Previous Issuse
    While testing my code i did find that the following code faild
    when testing the hotlink script.

    Example 1
    ----------------------------------------
    xx NOT WORKING xx
    -----------------
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?http://www.saxxxx-design.co.uk/.*$ [NC]
    RewriteRule \.(bmp|gif|GIF|jpe?g|png)$ http://www.saxxxx-design.co.uk/spam.png [R,L]
    -----------------
    
    Code (markup):
    Example 2
    -----------------
    
    --working---
    -----------------
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?saxxxx-design.co.uk(/)?.*$     [NC]
    RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://www.saxxxx-design.co.uk/spam.png [R,NC]
    -----------------
    
    Code (markup):
    I found that by removing the following line it worked fine.
    RewriteCond %{HTTP_REFERER} !^$
    Code (markup):
    Which i understand as
    So i have a Working Code with (IE)
    But how can i deal with Fire Fox?
    I have asked on there forums about Refferer information with out any reply.

    Rules
    Could some one help me if its possible to include a new rule,
    or condition which checks to see if its a Fire Fox Browser,
    and then allows that browser to view all the images.

    Can you have more than 1 rule in a htaccess script?

    I suppose i'm asking in lay mans terms,

    If the Browser = Fire Fox ignore the Following Rules and Conditions.
    If the Browser isnt Fire Fox go through the Conditions and if true
    excecute the Rewrite rule.

    Obviously if you have a better way of making this work then,
    please advise. I'm new to this and need some help please.

    Thanks for reading.

    Hot Link Alternative Image.
    For some strange reason, i couldnt use a gif. image
    as it caused a loop or somthing and would fail.
    I was advised to use a PNG file. and it works fine.
     
    Mark_Sc, Jul 4, 2006 IP