On a project I'm working on (currently on localhost on MAMP), the 404 page only works if I include the full URL with the ErrorDocument
statement in the .htaccess
file:
ErrorDocument 404 http://localhost:8888/project/public/404.php
I would like it so that I don't have to manually change this code as and when the site is uploaded from my localhost set up to a live server.
Because the 404 page sits at the same level as the .htaccess
file in the public
folder I thought I could use:
ErrorDocument 404 404.php
But this does not work, and instead just prints 404.php
to the screen when a 404 page should be used.
The folder structure is below, and project
is the root folder for the site.
project
— publicFolder
— privateFolder
How do I point the site to the 404.php page, without including the full URL, or in a way that will not need changing then the site is uploaded?