Custom error pages generator
Set your custom error pages using htaccess. Create a page just like any other, with a message like 'sorry, the page you are looking for cannot be found' (404) or 'there is a problem running this script' (500), enter the path to it below, and this generator builds the .htaccess code to point that error code at it.About custom error pages
By default, when something goes wrong on your site - a missing page, a crashed script - visitors see a generic, unbranded error page from your web server. A custom error page replaces it with your own design, so visitors get a helpful message and a way back to your site instead of a dead end.
To set one up: create a plain HTML page for each error code you want to handle (naming it something like 404.html makes it easy to keep track of later), then upload it to your website - either in the root folder for your domain or in a sub-folder. Enter the path to each page above, including the leading slash from your domain root, and this generator builds the ErrorDocument lines to add to your .htaccess file.
Copy the generated code into your .htaccess file (create one in a plain text editor, saved as ASCII, if you don't already have one) and upload it to your domain's root folder. FTP programs often hide it by default since files starting with a dot are treated as invisible - it's still there even if you can't see it. If you're applying this on a subdomain whose folder sits inside the main domain's folder, a relative path may not resolve correctly; use a full URL instead (e.g. https://sub.yourdomain.com/404.html).
Frequently asked questions
Do I need a separate page for every error code?
No - most sites only ever need a custom 404 page, and maybe 500. You can also point several codes at the same page if you'd rather show one generic "something went wrong" page instead of a different one for each code.
What's the difference between a 404 and a 500 error?
404 means the specific page doesn't exist - usually a typo'd URL or a deleted page. 500 means the page exists but a script on it crashed while running. They're worth separate custom pages: a 404 page can suggest search or navigation, while a 500 page should just apologise and suggest trying again shortly.
Will this work on any web host?
.htaccess and ErrorDocument are Apache (and Apache-compatible, like LiteSpeed) features. If your host runs Nginx or IIS you'll need the equivalent config for that server instead - check with your host if you're not sure what you're on.
My custom error page isn't showing on my subdomain - why?
This usually happens when the subdomain's document root is a subfolder of the main domain. Try entering the full URL instead of a relative path, e.g. https://sub.yourdomain.com/404.html.
