• Hey guys,

    For a client job, I am using a .htaccess file in the uploads directory to prevent unauthorized direct hot linking. Basically you have to be logged on to access restricted files…

    This works great, however for some reason when using IE7 and below users are unable to ‘save-target as’ by right clicking on the download file (i am using the Download Monitor wp plugin)…it simply downloads a useless .html file…

    I was hoping someone with the know how can check out the following code and point me in the right direction as to why this might be happening!

    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^https://(www\.)?site\.net/ [NC]
    RewriteCond %{REQUEST_URI} !hotlink\.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|zip|exe|rar|bin|dmg|msi) [NC]
    RewriteRule .*\.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|zip|exe|rar|bin|dmg|msi)$ https://site.net/ [NC]

    Cheers,
    Jarome.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jarome

    (@jarome)

    Any one?

    I am running out of things to say to the client, i really need to resolve this asap.

    Cheers,
    Jarome.

    Moderator James Huff

    (@macmanx)

    How about this instead?

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.net [NC]
    RewriteRule \.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|zip|exe|rar|bin|dmg|msi)$ - [NC,F,L]

    It requires the referenced media files (taken from your example) to be loaded from only site.net and blank referrers (if the users wanted to download the file).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help with .htaccess file.’ is closed to new replies.