NW Dave
04-05-2010, 06:59 PM
Hi Folks,
Added this .htaccess file to root to block hotlinking as per here: http://www.javascriptkit.com/howto/htaccess10.shtml
RewriteBase /images
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?pitman.us/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.pitman.us/images/angryman.jpg [R,L]
I added the first line of code as per instructions from server owner. (see below)
I placed the file in the root, and in the folder "images". Doesn't seem to work.
Can someone please point out where I went off the tracks?
Thank you,
Dave
My question to host:
Hi,
I wanted to set an .htaccess file to stop hotlinking. It is dependant on the the server having 'mod rewrite' enabled.
Is it so?
Their Reply:
Hello,
We use virtual user directory paths, so you can get error when trying to setup search engine friendly URLs or trying to pass virtual directory names to PHP scripts. If can be fixed very easy. Edit your .htaccess file and add this line at the top of the file or before the first rewrite rule:
RewriteBase /
Note: if your script is installed on some directory, for example /forum, you have to place RewriteBase /forum line to the .htaccess file (.htaccess file must be also located in /forum directory)
Added this .htaccess file to root to block hotlinking as per here: http://www.javascriptkit.com/howto/htaccess10.shtml
RewriteBase /images
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?pitman.us/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.pitman.us/images/angryman.jpg [R,L]
I added the first line of code as per instructions from server owner. (see below)
I placed the file in the root, and in the folder "images". Doesn't seem to work.
Can someone please point out where I went off the tracks?
Thank you,
Dave
My question to host:
Hi,
I wanted to set an .htaccess file to stop hotlinking. It is dependant on the the server having 'mod rewrite' enabled.
Is it so?
Their Reply:
Hello,
We use virtual user directory paths, so you can get error when trying to setup search engine friendly URLs or trying to pass virtual directory names to PHP scripts. If can be fixed very easy. Edit your .htaccess file and add this line at the top of the file or before the first rewrite rule:
RewriteBase /
Note: if your script is installed on some directory, for example /forum, you have to place RewriteBase /forum line to the .htaccess file (.htaccess file must be also located in /forum directory)