Welcome to WebmasterWorld Guest from 23.20.223.88

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

htaccess causing a 500 (internal config) error

htaccess config error

     
10:35 pm on Sep 21, 2006 (gmt 0)

5+ Year Member



I have successfully run htaccess up until this last week. I have Apache 2.0.59 installed and have had it for some time.

I can not figure out how to find what has changed.
here is my htaccess contents...

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com(/)?.*$ [NC OR]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?quux.com(/)?.*$ [NC]
RewriteRule .*\.(gif¦jpg¦jpeg¦bmp)$ http://www.example.com/NoHotlinks/NoHotlinks.gif [R,NC]

Right now I have htaccess disabled so my page can be online.

[edited by: jdMorgan at 10:41 pm (utc) on Sep. 21, 2006]
[edit reason] Examplified. [/edit]

10:43 pm on Sep 21, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



What do you see in your server error log file?

Jim

12:22 am on Sep 22, 2006 (gmt 0)

10+ Year Member



[NC OR] should have a comma seperating NC and OR, not a space.

However what you've got there is a condition which is triggered if the referrer is not example.com *or* not quux.com. Since the referrer can't be both, one of these conditions will always be true, so the rule will trigger on all image hits where there's a referrer. You should remove the OR so that it's only true if the referrer is neither domain.

12:29 am on Sep 22, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Well, since the cat's out of the bag, the whole thing could do with a rewrite:

RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?quux\.com [NC]
RewriteRule \.(gif¦jpe?g¦bmp)$ http://www.example.com/NoHotlinks/NoHotlinks.gif [R,NC]

Replace all broken pipe "¦" characters above with solid pipe characters from your keyboard before use; Posting on this forum modifies those pipe characters.

The first RewriteCond is not needed unless your site has a dedicated (non-shared) IP address. It is unnecessary on most name-based virtual servers (shared hosting), which are inaccessible via HTTP/1.0.

Jim

 

Featured Threads

Hot Threads This Week

Hot Threads This Month