Tutorials

How to Fix 404 Errors on Your Website

A 404 error means a page no longer exists at a given URL. Learn how to fix broken internal links, broken external links, and how to handle inbound broken links properly.

Last updated: Mar 28, 2026

A 404 error means a page does not exist at the requested URL. The server received the request, understood it, and responded clearly: there is nothing here. Fixing a 404 error means either restoring the missing page, redirecting the URL to a new location, or removing the link that points to it — depending on where the problem originates.

This guide covers all three scenarios in detail.

First: understand where the 404 is coming from

Before fixing anything, you need to know whether the broken link is internal or external.

An internal 404 means a page on your own website links to a URL that does not exist on your own website. You control both ends of the link — the page with the broken link and the missing destination. You can fix this directly.

An external 404 means a page on your own website links to a URL on someone else's website that no longer exists. You cannot fix the destination, but you can fix the link on your side.

A third scenario exists: someone else's website links to a page on your website that no longer exists. This is called an inbound broken link. You cannot fix their link, but you can make sure visitors who follow it land somewhere useful instead of a dead end.

dislike404.com scan results show you the exact page where each broken link was found and the URL it points to. That tells you immediately which scenario you are dealing with.

Fixing internal 404 errors

When a page on your website links to another page on your website that no longer exists, you have three options.

  • Restore the missing page. If the page was deleted by accident, or if it still has value, the simplest fix is to put it back. Recreate the page at the original URL and the 404 disappears immediately.

  • Set up a redirect. If the page was moved to a new URL, or if similar content exists elsewhere on your site, set up a 301 redirect from the old URL to the new one. A 301 redirect tells the browser — and search engines — that the page has permanently moved. Visitors who follow the old link land on the correct page, and any search engine ranking the old URL had is transferred to the new one. This is usually the best option when content has been reorganized or a URL structure has changed.

  • Update the link. If you know the correct destination, simply update the link on the page where it appears. Go to the page that contains the broken link, find the link, and change the URL to the correct one. This is the cleanest solution when the destination exists but the link is just wrong.

Which option to choose depends on the situation. If the old URL has external links pointing to it or had good search engine rankings, a redirect is better than just updating internal links — it preserves the value of the old URL. If the link is simply wrong and nobody outside your site links to the old URL, updating the link is sufficient.

Fixing external 404 errors

When your website links to a page on another website that returns a 404, you cannot fix the destination. The other website has removed or moved that content and you have no control over it. What you can do is fix your side of the link.

  • Find a replacement. Search for the content you were originally linking to. It may have moved to a new URL on the same website — check the site's homepage or search function. If you find the new URL, update your link.

  • Link to an archived version. If the content is gone entirely but still has value for your readers, the Wayback Machine at web.archive.org may have a saved copy. Linking to an archived version is not always ideal but is better than linking to a dead page.

  • Remove the link. If the content is gone and no replacement exists, remove the link from your page entirely. A missing link is better than a link that leads to an error page.

Handling inbound broken links

If another website links to a page on your site that no longer exists, their visitors will land on your 404 error page. You cannot ask every external website to update their links, but you can make sure those visitors do not hit a dead end.

Set up a redirect from the old URL to the most relevant page on your current site. If someone follows a link to a blog post you deleted, redirect them to a related post or your blog index. If a product page is gone, redirect to the product category. Even a redirect to your homepage is better than a 404 error page.

To find inbound broken links — links from other websites pointing to missing pages on yours — Google Search Console is the right tool. Under Coverage you can see which URLs on your site return errors, and under Links you can see which external pages link to your site.

Improving your 404 error page

Even with redirects in place, some 404 errors are unavoidable. A visitor might mistype a URL, or an old link from years ago might not have a redirect set up. A good 404 error page reduces the damage.

Your 404 page should make it easy for visitors to find what they were looking for. Include a link to your homepage, a search function if you have one, and links to your most important pages. A 404 page that simply says "page not found" with no further navigation loses the visitor entirely. A 404 page that offers useful next steps keeps them on your site.

Preventing 404 errors in the future

Fixing existing 404 errors is only half the work. The other half is making sure new ones do not appear.

When you delete or move a page, always set up a redirect before removing the old URL. This takes a few minutes and prevents the old URL from becoming a dead end.

When you restructure your website or change your URL format — for example during a CMS migration or a redesign — audit all your links before and after. A URL structure change can create hundreds of broken links at once if redirects are not set up in advance.

Scan your website regularly. External links break without warning — other websites go offline, move their content, or restructure their URLs at any time. A regular scan catches these before your visitors do. dislike404.com scans your website automatically on a schedule and notifies you when new errors are found, so you do not have to remember to check manually.

Setting up redirects in common CMS platforms

The process for setting up a 301 redirect depends on the platform your website runs on. Here is how to do it in the most common ones.

WordPress

WordPress does not have built-in redirect management, but several plugins handle this well. Redirection by John Godley is the most widely used — it is free, lightweight, and lets you add redirects without touching any code. Install the plugin, go to Tools → Redirection, and add the old URL and the new destination. The plugin also logs 404 errors automatically, which makes it easy to spot missing pages that are being requested.

If you prefer not to use a plugin, redirects can be added directly to your .htaccess file if your server runs Apache:

Redirect 301 /old-page https://www.example.com/new-page

Place this line in your .htaccess file in the root directory of your WordPress installation. Be careful when editing .htaccess directly — a syntax error can take your site offline. Always make a backup first.

Shopify

Shopify has built-in redirect management. Go to your Shopify admin, navigate to Online Store → Navigation, and click URL Redirects. Add the old path and the new destination. Shopify handles the rest.

Note that Shopify only allows redirects from paths that do not currently exist as live pages. If a page is still active, you need to delete or unpublish it before a redirect for that URL will work.

Squarespace

Squarespace includes URL redirect management under Settings → Advanced → URL Mappings. Add your redirect in the following format:

/old-page → /new-page 301

Squarespace applies redirects in order from top to bottom, so if you have multiple redirects, make sure they are in the right sequence.

Webflow

In Webflow, go to your project settings and open the Hosting tab. Under 301 Redirects, add the old path and the new destination. Publish your site after adding redirects for them to take effect.

Custom or self-hosted websites

If your website runs on a custom stack or a self-hosted CMS, redirects are typically handled at the server level.

On Apache, add the redirect to your .htaccess file or your virtual host configuration:

Redirect 301 /old-page https://www.example.com/new-page

For pattern-based redirects — for example redirecting an entire old URL structure — use RewriteRule in combination with RewriteEngine:

RewriteEngine On RewriteRule ^old-section/(.*)$ /new-section/$1 [R=301,L]

On nginx, redirects go in your server block configuration:

location = /old-page { return 301 https://www.example.com/new-page; }

For pattern-based redirects in nginx:

location ~* ^/old-section/(.*)$ { return 301 /new-section/$1; }

After editing nginx configuration, reload the service for changes to take effect.

On Laravel specifically, redirects can be added in your routes file:

Route::redirect('/old-page', '/new-page', 301);

Or handled in middleware for more complex redirect logic.

Testing your redirects

After setting up a redirect, always verify it works correctly. Open a browser and visit the old URL — you should land on the new destination automatically. You can also use a tool like curl in the terminal to inspect the response headers and confirm the status code is 301:

curl -I https://www.example.com/old-page

The response should show HTTP/1.1 301 Moved Permanently with a Location header pointing to the new URL.

If you are setting up multiple redirects at once, check for redirect chains — situations where URL A redirects to URL B which redirects to URL C. Each redirect in the chain adds a small delay and search engines prefer direct redirects. Where possible, redirect straight to the final destination.