PDA

View Full Version : .htaccess problem!


SuperA
11-21-2000, 08:24 PM
Im trying to stop some hotlinkers on my server and put this into the .htaccess file:

---
AuthUserFile /dev/null
AuthGroupFile /dev/null
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://domain.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://123.123.123.123/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://123.123.123.123:80/.*$ [NC]
RewriteRule .*\.[Jj][Pp][Gg]$|.*[Jj][Pp][Ee][Gg]$|.*[Gg][Ii][Ff]$ http://www.domain.com [R,L]
---

After I've done that NO images get displayed on my server (or the hotlinkers site). When I try to go to my site I get the famous "500 Internal Server Error" and when I look into my error logs it say "RewriteEngine not allowed here" so now my question is, how do I enable it? WHERE do I enable it? in httpd.conf?

Please help me out so I can protect my bandwidth http://adultwebmasterinfo.com/ubb/smile.gif

Crazyman
11-22-2000, 01:03 AM
Hi.
I dont know if itīs the "/" thing thatīs the problem....
My code looks like this:
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://www.mydomain.com/whatever.html

Coke
11-22-2000, 09:47 AM
Add:

AllowOverride All
in the <VirtualHost ...> </VirtualHost> tag in the httpd.conf file.

SuperA
11-22-2000, 03:49 PM
Thanks for your reply Crazyman and Coke! http://adultwebmasterinfo.com/ubb/smile.gif

Coke, when I put what you wrote into httpd.conf then I get this message when I restart apache "AllowOverride not allowed here"

Any new suggestions? http://adultwebmasterinfo.com/ubb/smile.gif

Thanks,

Andy

moses
11-23-2000, 12:59 AM
SuperA:

In the virtualhost, put something like:
<Virtualhost whatever.com>
<Directory /where/ever/the/document/root/is>
AllowOverride All
</Directory>
</VirtualHost>

So the virtulhost will look something like:
<VirtualHost whatever.com
DocumentRoot /home/htdocs/supera/whatever.com
ServerName whatever.com
ServerAlias www.whatever.com (http://www.whatever.com)
ServerAdmin webmaster@whatever.com
<Directory /home/htdocs/supera/whatever.com>
AllowOverride All
</Directory>
</VirtualHost>

Worth a shot.

moses
11-23-2000, 01:00 AM
Ack, missing a > in the
<VirtualHost whatever.com>

SuperA
11-24-2000, 03:22 PM
Moses, I added it like you wrote and it didnt work and I get the same error message as before "RewriteEngine not allowed here"

But now all visitors can access my sites but they cant see the files that im trying to block from hotlinkers. (before I just got an 500 Internal Error)

Any new ideas? http://adultwebmasterinfo.com/ubb/smile.gif (I have read everything I could find about apache, on apache.org and other sites, without finding anything about this error)

If anyone can help me please write here or send me an message over ICQ# 3036409

Thanks,

Andy

Coke
11-24-2000, 03:44 PM
Oops that isn't allowed there.

Add the following to your httpd.conf file (outside of ANY virtualhosts etc) :

<Directory /pathto/your/public_html_dir>
AllowOverride All
</Directory>

Coke
11-24-2000, 03:46 PM
Moses' solution should have worked too though. Weird.

Coke
11-24-2000, 03:49 PM
Btw you didn't compile your server on your own, did you? That way you might have disabled the rewrite_mod.