Forum Moderators: phranque
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]
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
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? :)
Jim