setting a default error 404 page

closed account (Dy7SLyTq)
so i know i said i wouldnt bother you guys with another php post, but Daniweb (the site im using to ask questions) has this user Warren80 that knows nothing about code (and endorsed me for javascript (i dont know why)) and is the only one helping me (which consists of him throwing tutorials for the problem at me) anyways im trying to set a default 404 error page. i put a .htaccess file in my LAMPs root (/var/www) and pointed it to my error page, but its not working
What's in the .htaccess file and are there others? If so you may need to put it in the others to.
closed account (Dy7SLyTq)
no theres only one. the .htaccess file contains
ErrorDocument 404 error/error404.php
thats all thats in it. and i have made sure that is the correct path. i have also tried localhost/error/error404.php and 127.0.0.1 instead of local host and just /error/error404.php. i have also tried an absolute path that didnt work
ya that sounds really weird have you tried re-installing it?
closed account (Dy7SLyTq)
no, but i found out since my dad controls the network he has to do something. so i think its something he set and he said he would make it so it would go to my page instead
im trying to set a default 404 error page


Assuming your using an ubuntu server with default paths:

you can just modify what file the error goes to in the path:
/etc/apache2/conf.d/localized-error-pages,
and add your custom error page to
/usr/share/apache2/error
after modifying this you should see your custom error page via a wrong address

EDIT:
you might have to add a php handler if they are php
AddHandler php5-script php
else if its html:
AddOutputFilter Includes html

and out of habit, i normally restart apache to ensure the change (i dont know if it is needed for sure or not with a 404 page change)
sudo service apache2 restart

i forgot the exact procedure as i haven't done it in awhile.
Last edited on
closed account (Dy7SLyTq)
Assuming your using an ubuntu server with default paths:

i am
thanks ill try that. do i add the handler to localized-error-pages?
i would assume so,

I would first try within:
<Directory "/usr/share/apache2/error">

if that doesnt work, i would tail the error log as you attempt to visit a non existant page, adn see if that outputs something missed

tail -f /var/log/apache2/error.log

if after that still not sure, i would point the error page to an html file to find out if its php related or not.

EDIT:
oh yeah i guess if you are using a php script in there you will also need to add to the same
Options +ExecCGI +Includes
Last edited on
Topic archived. No new replies allowed.