Ticker

6/recent/ticker-posts

Ad Code

How to FIx 404 Not Found Error

 

A 404 error code, or "404 Not Found" error, is an HTTP status code indicating that the server could not find the requested page or resource. Unlike a 403 error (which means "Forbidden" due to permissions), a 404 error means the page is missing entirely or the URL was incorrect.

Common Causes of a 404 Error

  1. Broken or Dead Links: The link might point to a page that no longer exists.
  2. Incorrect URL: A typo or error in the URL can result in a 404 error.
  3. Deleted or Moved Pages: The requested page may have been deleted or moved to a new URL without a redirect.
  4. Domain Name Issues: Sometimes, DNS problems or expired domains can also trigger 404 errors.

How to Fix a 404 Error (for Website Owners)

First of all Ensure the URL is correct. If URL is correct then follow bellow steps to solve the problem

Set Up Redirects:

Setting up redirects can solve 404 errors by automatically sending visitors from a missing page to a relevant, active page on your site. Here’s how you can set up redirects using various methods:

1. Set Up Redirects Using WordPress Plugins (for WordPress sites)

  • Solution: If you have a WordPress site, use a plugin to manage redirects easily. Popular options include:
    • Redirection: Allows you to set up 301 redirects, track 404 errors, and manage redirections from within the WordPress dashboard.
    • Yoast SEO (premium): Offers redirect management along with SEO features.
  • Instructions:

1.                  Install and activate the chosen plugin.

2.                  Navigate to the plugin’s redirect settings, usually under Tools > Redirection (for Redirection plugin).

3.                  Enter the source URL (old/missing page) and the target URL (new page) to create the redirect.

2. Using .htaccess File (for Apache Servers)

  • Solution: Add redirect rules in your .htaccess file, located in your website’s root directory. This method is powerful but requires care to avoid breaking the site.
  • Instructions:
    1. Open your .htaccess file (using an FTP client or file manager in your hosting control panel).
    2. Add a line like this for each redirect:

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

·         Replace /old-page-url with the path of the missing page and /new-page-url with the path of the current page.

·         Use the full URL if redirecting to another domain:

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

3.Save the file and test the redirect.

3. Using cPanel Redirect Tool (for cPanel Hosting)

  • Solution: Many hosts provide a simple redirect tool in cPanel, which automates the redirect process.
  • Instructions:
    1. Log in to your cPanel account.
    2. Go to Domains > Redirects.
    3. Choose the redirect type (301 for permanent).
    4. Enter the old URL and the new URL where you want visitors redirected.
    5. Click Add to create the redirect.

4. Using Nginx Configuration (for Nginx Servers)

  • Solution: Nginx servers don’t use .htaccess, so redirects need to be added directly to the Nginx configuration.
  • Instructions:
    1. Open the Nginx configuration file, usually located in /etc/nginx/nginx.conf or a similar directory.
    2. Add a redirect line:

rewrite ^/old-page-url$ /new-page-url permanent

    • Replace /old-page-url and /new-page-url accordingly.
    1. Save the file and reload Nginx:

sudo systemctl reload nginx

5. Using JavaScript or Meta Refresh (Less Preferred)

  • Solution: JavaScript or meta refresh redirects aren’t recommended for SEO but can work as temporary solutions.
  • Instructions:
    • JavaScript: Add this in the <head> section of the old page:

<script>

window.location.href = "https://example.com/new-page-url";

</script>

    • Meta Refresh: Add this to the old page’s <head>:

<meta http-equiv="refresh" content="0; URL='https://example.com/new-page-url'" />

Using these methods, you can easily set up redirects to resolve 404 errors and guide users to relevant pages.

If you are still facing the problem then you can try bellow steps

·         Create a Custom 404 Page: Design a friendly 404 error page to guide users back to the main site, provide links to popular content, or suggest a search function.

·         Use Broken Link Checkers: Tools like Google Search Console or online link checkers can identify broken links on your site.

Post a Comment

0 Comments