Forum Moderators: phranque
There are no scripts, permissions or restrictions being used, it's just normal virtual hosting on Linux/Apache. What could be the problem?
Does your error log contain an entry when this happens? Without further detail, it's pretty hard to tell, other than to say you've put some bad code in your .htaccess file or your host has messed up your server config in httpd.conf.
If this used to work, and suddenly stopped working, and you've made no changes to your .htaccess files or scripts, then contact them and tell them that whatever they've done in the period since it last worked has broken your site.
Jim
This is what I did
AddType application/x-httpd-php .html .php .htm
AddHandler application/x-httpd-php .html .php
And I did this, too
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^http://example.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://example.com$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.example.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.example.com$ [NC]
RewriteRule .*\.(jpg¦jpeg¦gif¦png¦bmp)$ - [F,NC]
Added:
Changed the first to this and stopped getting the error:
AddType application/x-httpd-php .html .php .htm
AddHandler application/x-httpd-php .html .php .htm
I'm not sure if both of those are needed; I just want to be able to use php includes on regular html pages.
Probably something to do with the default index page handling... I dunno.
You can get rid of three unnecessary lines and unneeded overhead in your code if you'd like to speed things up a bit:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]
RewriteRule \.(jpe?g¦gif¦png¦bmp)$ - [NC,F]
Also, I'd strongly recommend that you consider what happens to AOL users and other users whose ISPs block the referrer data or use caching proxies -- and a lot of them do. These visitors will see broken images on your site.
Unfortunately, the fix is to allow blank referrers, and some of those will be hotlinkers. So this is a choice everyone has to make for themselves.
You can fix the broken image problem by adding the line
RewriteCond %{HTTP_REFERER} . Jim