UnderHost
Knowledgebase Docs

404 error-file not found pages and fixes

Fix 404 errors when files are deleted, URLs changed, or misconfigured. Create custom 404 pages and implement redirects in WordPress.

On this page

A 404 error means the web server understood your request but cannot find the requested file or page. This happens when a URL points to a deleted file, a broken link, or a page that doesn't exist.

Common causes

  • Page was deleted: A post/page existed before but was removed
  • Broken link: Someone linked to a wrong URL or outdated link
  • URL changed: Site migrated or renamed pages (old URLs now invalid)
  • Wrong file location: File exists but in a different directory
  • Case sensitivity: URL is /MyPage but file is /mypage (Linux servers are case-sensitive)
  • Missing file: You're accessing a file that was never uploaded

Check and fix your URLs

For WordPress: Go to Settings → Permalinks and verify your URL structure matches your site navigation. Check that no posts were accidentally deleted.

For static sites: Check File Manager to confirm the requested file exists at the expected path.

Case-sensitive check: On Linux servers, /Page is different from /page. Verify the exact filename matches.

Create a custom 404 page

For WordPress: By default, WordPress shows a simple "Page not found" message. To customize it:

  1. Create a new page titled "404 Not Found"
  2. Add helpful content (suggest related articles, search form, site map)
  3. Copy the page ID
  4. Add to functions.php: define('NOTFOUND_404_PAGE_ID', 123); (replace 123 with your page ID)

Set up redirects for moved pages

For WordPress: Use Redirection plugin or add to .htaccess:

Redirect 301 /old-page/ /new-page/

For static sites: Add to .htaccess:

RedirectMatch 301 ^/products/$ /new-products/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.html [L]
Use 301 redirects for SEO

A 301 redirect tells search engines the old page moved permanently to the new location, preserving SEO rankings. Use 301, not 302 (temporary).

Related: 403 Forbidden errors | WordPress redirects

Was this article helpful?

Still troubleshooting?

Use UnderHost tools for quick checks, or open a support ticket when the issue needs account or server access.

Related articles

Back to Troubleshooting