1. Create the pages
In public_html, create simple HTML pages such as 404.html and 500.html. A good 404 page:
- says clearly the page wasn’t found
- links to the home page and key sections
- offers search if your site has it
- uses the same design as the site
Use absolute paths for CSS and images (/css/style.css), because the page is shown at whatever URL was requested.
2. Point the server at them
In public_html/.htaccess:
ErrorDocument 404 /404.html
ErrorDocument 403 /403.html
ErrorDocument 500 /500.html
Use a local path, not a full URL. A full URL makes the server redirect to the page, returning a 302 status instead of 404, which tells search engines the missing page exists.
3. Test
Visit a URL that doesn’t exist, such as /this-does-not-exist. Your page should appear, and in browser developer tools (Network tab) the status should be 404.
WordPress and frameworks
These handle their own 404s through the theme (404.php) or application routing. ErrorDocument still covers files outside the application.
Keep the 500 page simple
If PHP is what’s failing, a 500 page that uses PHP fails too. Make it plain HTML.
Traxio accounts include SSH, Git, cron and PHP 7.4 to 8.3. Try the PHP hosting is free for 30 days with no card, then £0.99 a month.