Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: .htaccess help

  1. #1
    New Coder
    Join Date
    Mar 2005
    Location
    Indiana (USA)
    Posts
    50
    Thanks
    4
    Thanked 0 Times in 0 Posts

    .htaccess help

    OK i want to make it so that when an image is hot linked it showes a different image. I ahve the code that SHOULD do that. It does that, but i have the code in there that should allow direct linking (viewing it form the browser). The viewign formthe browser part doesn't work! Here is my .htaccess file:
    Code:
    <Files ~ "^\.ht">
    order allow,deny
    deny from all
    satisfy all
    </Files>
    
    Options -Indexes
    
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://megars.illusionfxnet.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://megars.illusionfxnet.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.megars.illusionfxnet.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.megars.illusionfxnet.com$      [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ http://img220.exs.cx/img220/1497/x1ul.jpg [R,NC]
    This does not allow the the viewing of .htaccess or .ht* files
    Code:
    <Files ~ "^\.ht">
    order allow,deny
    deny from all
    satisfy all
    </Files>
    This disables indexes
    Code:
    Options -Indexes
    This is the hotlinkign part

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://megars.illusionfxnet.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://megars.illusionfxnet.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.megars.illusionfxnet.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.megars.illusionfxnet.com$      [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ http://img220.exs.cx/img220/1497/x1ul.jpg [R,NC]
    The first line i knows make sit so you can disabel the hotlinking
    The next line is what SHOULD allow things that are directly linked
    The next 4 lines say that my site is ok for images to be shown
    the next line says that anythign with the extension i specify is not shown

    well the part for direct linking doesn't work!

    I also want to learn all the thing you can do in the htaccess file and how, so i can write a generator. The thing Cpanel has isn't exactly that good...

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    UK
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is my hotlinking .htaccess file:

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://www.bmw-forums.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://bmw-forums.com/.*$ [NC]
    RewriteRule \.(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)$ http://www.bmw-forums.com/piclink.gif [L]
    This one works fine


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •