.htaccess file not working


#1

Okay I finally started in on setting up setting up a .htaccess file for my site (ed.fanworks.net) :


AddDefaultCharset iso-8859-1

ErrorDocument 500 /home/crysc/ed.fanworks.net/error/500_internal_server_error.phtml
ErrorDocument 404 /home/crysc/ed.fanworks.net/error/404_page_not_found.phtml
ErrorDocument 401 /home/crysc/ed.fanworks.net/error/401_password_required.phtml
ErrorDocument 403 /home/crysc/ed.fanworks.net/error/403_no_access.phtml

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://fanworks.net/.$ [NC]
RewriteCond %{HTTP_REFERER} !^http://pub21.ezboard.com/.
$ [NC]
RewriteCond %{HTTP_REFERER} !^http://..fanworks.net/.$ [NC]
RewriteRule .*.(gif|GIF|jpg|JPG|png|PNG|jpeg|JPEG)$ - [F]


The first line works the xhtml validator’s not screaching about the lack of a charset anymore – but the other lines are doing nothing… I’ve tried the error doc both as full server paths and without the stuff above the http root. Similar results in IE & NS so it’s not just the IE ‘friendly’ error msgs doing somthing to mine…


#2

They are supposed to be URL paths, not file system paths OR include the server name.
See ErrorDocument run-time directive

ErrorDocument 500 /error/500_internal_server_error.phtml ErrorDocument 404 /error/404_page_not_found.phtml ErrorDocument 401 /error/401_password_required.phtml ErrorDocument 403 /error/403_no_access.phtml Should work.

Here’s a funny Flash animation - Homestar Runner - System is down


#3

Maybe I phrased it poorly in my first post, but I tried those as well – actually first.


#4

OK we can see then that your error documents are located at

http://ed.fanworks.net/error/

See we visit http://ed.fanworks.net/error/ and what do we find:

Parent Directory 09-Feb-2003 00:00 - 401_password_required.phtmltrash 08-Feb-2003 18:11 2k 403_no_access.phtmltrash 08-Feb-2003 18:13 1k 404_page_not_found.phtmltrash 08-Feb-2003 18:01 2k 500_internal_server_error.phtmltrash 08-Feb-2003 18:01 2k It appears that the files have bad names. You need to remove the “trash” from the end of the filenames, and then Apache will be able to find the error documents. I’m pretty sure if you check your error.log you’ll see Apache telling you that it couldn’t find /error/500_internal_server_error.phtml !!

How did “trash” get added to the end of the filename??


#5

::blush:: CMS error: I screwed up a setting in the program generating those files – Crys no Baka (Crys is an idiot)

That part works fine now. and I think I know what’s wrong with the third part now.


#6

And everything works now :smiley:


Options -indexes

AddDefaultCharset iso-8859-1

ErrorDocument 500 /error/500_internal_server_error.phtml
ErrorDocument 404 /error/404_page_not_found.phtml
ErrorDocument 401 /error/401_password_required.phtml
ErrorDocument 403 /error/403_no_access.phtml

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://fanworks.net/.$ [NC]
RewriteCond %{HTTP_REFERER} !^http://pub21.ezboard.com/.
$ [NC]
RewriteCond %{HTTP_REFERER} !^http://..fanworks.net/.$ [NC]
RewriteRule .*.(gif|GIF|jpg|JPG|png|PNG|jpeg|JPEG)$ - [F]