Forum Moderators: phranque

Message Too Old, No Replies

Windows XP with Apache and hotlink protection

         

madman71

7:35 pm on May 21, 2008 (gmt 0)

10+ Year Member



Im familiar with hotlink protection when apache is on a Linux OS. However, Im setting up a XP system with apache on it and im having a hell of of time protecting my links with using .htaccess.

I've read some place that .htaccess wont work on windows machines. However, I have also read tutorials (not hotlinking tutorials)on where they were using .htaccess.

So my question is, can i protect my links on a windows box with apache running with using htaccess?

I've already made sure that the "#" symbol has been removed from the rewrite mod in the httpd.conf file. I guess removing this enables you to hotlink protect files.

I have tried many different hotlink directives and none of them work :(

Ive tried using generator sites too. None of them protected me.

one says hotlink protection will not work on windows boxes

any advice?

[edited by: jdMorgan at 8:55 pm (utc) on May 21, 2008]
[edit reason] Removed URLs -- Please see Terms of Service [/edit]

jdMorgan

9:03 pm on May 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



anti-hotlinking and mod_rewrite will work just fine on Windows.

What won't work is using the filename ".htaccess" because Windows considers it to be a "nameless" file with a file extension of ".htaccess".

On Windows it is usual to name the file "htaccess" (no dot) or "htaccess.txt". This will require you to declare the htaccess filename using the AccessFileName [httpd.apache.org] directive.

In order to use mod_rewrite, you will also need to set the FollowSymLinks Option -- either in httpd.conf, conf.d, or other server-config-level file, or in htaccess itself. If you want to set it in htaccess itself, then you must specify "AllowOverride Options" in the server config file in order to allow the use of "Options +FollowSymLinks" in htaccess.

For best results, do not enable MultiViews (content negotiation) unless you intend to use it -- MultiViews can interfere with mod_rewrite and produce unexpected results.

Jim

madman71

9:26 pm on May 21, 2008 (gmt 0)

10+ Year Member



Thank you. Im glad it's just a setting/file.

As soon as i get home i'll try out what you suggest.

again, thank you

madman71

3:50 am on May 22, 2008 (gmt 0)

10+ Year Member



Ok, im having a bit of a problem here.

First I renamed my .htaccess file to "ht.htaccess" so windows can see it

then in the httpd.conf file, i placed this in it:
---------------------------

AccessFileName ht.htaccess

<Files ~ "^(ht)?\.ht">
Order allow,deny
Deny from all
</Files>

----------------------------

Im assuming this tells apache not look for the .htaccess file but the one that I have specified.

For the FollowSymLinks Option, Im not sure what to set this at. I will say i'd like to set it in the httpd.conf file. How should I set this?

This is what i have in my ht.htaccess file so far:

------------------------------------------------------
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

Options All -Indexes

## DISABLE HOTLINKING
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomainname.com [NC]
RewriteRule \.(jpg¦jpeg¦png¦gif¦rar¦zip)$ - [NC,F,L]

--------------------------------------------------------------------------

can you give me a little guidance please? :)

jdMorgan

4:08 pm on May 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See the Options directive in the Apache core directives documentation [httpd.apache.org]. I can't tell you how to set it, because that depends on what you want. If you are trying to replicate a 'live' site's hosted server, then set it in the same way as that live site's server.

Jim