Web Hosting Talk







View Full Version : Apache rewrite_mod


huh
02-19-2002, 04:57 AM
Hi,
I really tried to figure this out on my own but I am helpless, and it's 3.50 am, so I am asking for help. I need to prevent people from including my images on their website. I don't care if they copy them, I just don't want to pay for the bandwidth.

I searched and was told that mod rewrite would work so I made this .htaccess file and placed on the images dir:

AuthUserFile /home/domain/.htpasswd
AuthGroupFile /dev/null
AuthName Password_Required
AuthType Basic
<Files admin.php>
<Limit GET POST>
require valid-user
</Limit>
</Files>

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://domain.com/images/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/images/.*$ [NC]
RewriteRule .*\.gif$ - [L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://domain.com/images/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/images/.*$ [NC]
RewriteRule .*\.jpg$ -


Now I get a server error and the log file has this:
RewriteEngine not allowed here.

I even tried without the first part of the .htaccess (leaving only the rewrite lines)

I didn't do anything with the httpd.conf but I know that mod_rewrite is enabled because of the server headers. Can someone help?

I would really appreciate it, thanks

priyadi
02-19-2002, 06:38 AM
Your httpd.conf probably disallows the use of mod_rewrite inside .htaccess files. I don't know which directive that diallows it, but probably it is 'Options'. Make sure you have Options +FollowSymLinksIfOwnerMatch on your httpd.conf. If that won't solve your problem, you may need to start from a fresh httpd.conf. :)

sufehmi
11-05-2004, 07:11 AM
Correction - you should make sure that said directory has "AllowOverride FileInfo" applied to it.

Sorry for replying to such an old thread - but I just had similar problem, and this post showed up in the first page on Google :)