Site Setup
How to Set Up a Custom 404 Page That Keeps Visitors on Your Site
A default 404 page is a dead end for anyone who mistypes a URL or follows a broken link, while a branded custom 404 page turns that same moment into a chance to guide them back to something useful.
1 line
The .htaccess directive needed to point to a custom 404 page
404.php
The WordPress theme file that overrides the default error page
cPanel-style
Panel used to edit .htaccess directly through File Manager
24/7
Human support available if the custom page doesn't load correctly
In short
How to create a custom 404 page depends on the platform: on a standard cPanel-style site, an .htaccess line like ErrorDocument 404 /404.html points broken links to a custom HTML file. On WordPress, adding a 404.php template file to the active theme lets the page match the site's design automatically using standard WordPress template tags.
A 404 error fires whenever a visitor requests a URL the server can't find - a mistyped address, an outdated link from another site, or a page that's since been deleted or moved. Left at the server's plain default page, that moment reads as broken and unfinished, and most visitors leave immediately rather than trying to find their way back into the site through a header they can't see.
A custom 404 page fixes that by matching the site's actual design and adding a way forward: a search box, links to popular pages, or simply the main navigation menu, all things the default error page doesn't include. It's a small piece of setup that directly affects how many visitors who hit a dead link still end up somewhere useful on the site instead of leaving through the back door.
Building the custom 404 page itself
Before wiring anything up, the 404 page needs actual content worth landing on: the site's header and navigation so visitors aren't stuck, a brief and friendly message explaining the page wasn't found, and at least one clear path forward, whether that's a search box, a link back to the homepage, or a shortlist of popular pages. Keeping the same visual design as the rest of the site matters more than clever copy - a jarring, unstyled page undercuts the whole point of customizing it.
For a standard HTML site, this is simply another page file - commonly named 404.html - built with the same header, footer, and styling as everything else. For a WordPress site, the same content gets built as a template file within the active theme, using the theme's existing header and footer template parts so it automatically matches whatever design the rest of the site already uses.
Wiring it up with .htaccess on a standard site
On a non-WordPress site running Apache (which LiteSpeed is compatible with), a single line added to .htaccess tells the server where to send visitors who hit a missing page: ErrorDocument 404 /404.html, using a path relative to the site's root directory. This file can be edited directly through cPanel's File Manager, or uploaded via FTP, and takes effect immediately without any further configuration.
One detail that trips people up is using an absolute URL instead of a root-relative path in some configurations, or placing the 404.html file in the wrong directory relative to where .htaccess lives - both of which can cause the custom page to silently not load, falling back to the server's own default instead. Testing the setup by visiting a deliberately broken URL on the live site confirms it's working correctly rather than assuming it is.
Setting up a custom 404 in WordPress
WordPress handles 404 pages through its own template hierarchy rather than .htaccess: adding a 404.php file to the active theme's folder overrides the default error page WordPress otherwise generates. This template can use the same get_header() and get_footer() calls as any other theme file, along with standard WordPress functions like get_search_form() to add a search box, ensuring the custom 404 page inherits the site's actual navigation and styling automatically.
For site owners who'd rather not edit theme files directly, many WordPress themes include a built-in 404 template that can be styled through the Customizer, and some page builder plugins offer a visual editor specifically for the 404 template without touching code. Either route accomplishes the same goal - the key is confirming the change is actually active by visiting a genuinely broken URL on the live site afterward.
Common mistakes that keep the default page showing
The most frequent issue is a caching layer serving an old cached version of a broken URL's response, which can mask a correctly configured custom 404 page during testing. Clearing any page cache and testing in a private browser window rules this out. Another common mistake is a 404 page that itself returns a 200 status code instead of an actual 404 status - which search engines can flag as a soft 404, since a page claiming success while showing error content confuses how a working page is defined for crawling purposes.
Checking that the 404 page correctly returns a 404 HTTP status (rather than 200) can be done through a browser's developer tools network tab or an online HTTP status checker. If a custom 404 page keeps failing to appear after checking .htaccess or the WordPress template file, 24/7 human support can confirm whether a server-level configuration is overriding it before more time goes into troubleshooting the same files.

Build and troubleshoot a custom 404 page with support on hand
Hosting Cheap's cPanel-style panel makes editing .htaccess or uploading a WordPress 404.php template straightforward through File Manager, and 24/7 human support is available if the custom page doesn't take effect as expected.
NVMe SSD and LiteSpeed keep the custom 404 page loading just as fast as the rest of the site, so a lost visitor isn't kept waiting on top of already landing on a dead link.
- cPanel File Manager for editing .htaccess or uploading a 404 template
- Works for both standard HTML sites and WordPress installs
- NVMe SSD + LiteSpeed keep the custom page loading fast
- 24/7 human support if the page doesn't override the server default
Why Hosting Cheap
What you get
Keeps visitors on-site
A branded 404 page with navigation and a search option gives lost visitors a way forward instead of leaving.
Matches your site's design
Building the 404 page from the same header, footer, and styling keeps the experience consistent.
Simple to wire up
A single .htaccess line or a WordPress 404.php template file is all that's needed to activate it.
Fast loading, even on error
NVMe SSD and LiteSpeed keep a custom 404 page loading as quickly as any other page on the site.
cPanel-style File Manager
Edit .htaccess or upload theme files directly without needing separate FTP software.
24/7 human support
Support can help confirm why a custom 404 page isn't overriding the server default when troubleshooting stalls.
How It Works
Get set up in a few steps
Design the custom 404 page content
Include the site's header, a clear message, and a way forward like a search box or link to the homepage.
Add the page or template file
Upload 404.html to the site root for standard sites, or add 404.php to the active WordPress theme folder.
Wire it up and test on a live broken URL
Add the ErrorDocument 404 line to .htaccess for standard sites, then visit a deliberately broken link to confirm it works.
Included
Everything you need, on every plan
- Design the 404 page with the same header, footer, and styling as the rest of the site
- Include a search box or links to popular pages so visitors have somewhere to go
- Add ErrorDocument 404 /404.html to .htaccess for a standard HTML site
- Add a 404.php file to the active theme folder for a WordPress site
- Use get_header() and get_footer() in a WordPress 404.php template for consistent design
- Test the setup by visiting a genuinely broken URL on the live site
- Confirm the page returns an actual 404 status code, not 200, to avoid a soft 404
- Clear any page cache before testing to rule out a stale cached response
FAQ
Frequently asked questions
How do I create a custom 404 page without WordPress?
Build a 404.html file with your site's header, footer, and a message, upload it to the site root, then add ErrorDocument 404 /404.html to .htaccess through cPanel's File Manager.
How do I set up a custom 404 page in WordPress?
Add a 404.php file to the active theme's folder using get_header() and get_footer() so it matches the site's design, or use a theme's built-in 404 template option if one is included.
Why isn't my custom 404 page showing up?
Common causes include a caching layer serving a stale response, an incorrect file path relative to .htaccess, or the file being placed in the wrong theme folder. Testing in a private browser window after clearing cache usually clarifies which it is.
What is a soft 404 and why does it matter?
A soft 404 is when a page shows 'not found' content but actually returns a 200 success status code instead of 404, which can confuse how search engines interpret the page during crawling.
What should a custom 404 page include?
At minimum, the site's normal header and navigation, a clear and brief explanation the page wasn't found, and one way forward - a search box, a homepage link, or a list of popular pages.
Can I edit .htaccess through cPanel without FTP?
Yes, cPanel's File Manager can open and edit .htaccess directly in the browser, including toggling visibility for hidden files if it isn't shown by default.
Related hosting
Web Hosting
cPanel-style hosting with File Manager access for editing .htaccess directly, from $2.09/mo.
WordPress Hosting
WordPress-optimized hosting for building and testing a custom 404 template, from $4.19/mo.
CMS Hosting
Hosting for CMS platforms that each handle custom error pages through their own templating system.
Website Builder
A guided way to build site pages, including error pages, without editing code directly.
Ready to build a custom 404 page that keeps visitors on-site?
Use cPanel's File Manager to wire up .htaccess or a WordPress template, and reach 24/7 human support if the custom page isn't showing correctly.
Get Started