How to Fix 404 on AMP Pages After Deactivating the AMP Plugin

Accelerated Mobile Pages (AMP) have become a vital aspect of modern web development, significantly enhancing the loading speed and mobile-friendliness of web pages.
Fix 404 on AMP Pages After Deactivating
However, there are instances when website owners need to deactivate the AMP plugin for various reasons. One common issue that can arise after deactivating the AMP plugin is encountering 404 errors on previously functional AMP pages. In this guide, we will delve into the reasons behind this problem and provide step-by-step solutions to fix 404 errors on AMP pages after deactivating the AMP plugin.

Understanding the 404 Error

Before we jump into the solutions, let’s take a moment to understand what a 404 error actually is. A 404 error, also known as the “Not Found” error, occurs when a web server cannot find the requested page. This can happen due to various reasons, such as incorrect URL, deleted or moved page, or in our case, when the structure of the website changes due to deactivating the AMP plugin.

Also Read: How to Fix “HTTP Error” when Uploading Images in WordPress

Reasons for 404 Errors on Deactivated AMP Pages

Deactivating the AMP plugin can lead to 404 errors on previously accessible AMP pages due to several reasons:

  1. Rewrite Rules: AMP plugins often implement rewrite rules to display AMP versions of pages. Deactivating the plugin may remove or alter these rewrite rules, causing the server to fail in locating the appropriate AMP content.
  2. Cached Pages: Some caching mechanisms, like server-side caching or caching plugins, might have cached the AMP versions of your pages. Deactivating the plugin can result in serving cached content that is no longer in line with your current website structure.
  3. Database Changes: Deactivating the AMP plugin might involve changes to the database, such as removing AMP-related metadata. If these changes are not handled correctly, the server might not be able to retrieve the correct content.

Steps to Fix 404 Errors on Deactivated AMP Pages

Now that we understand why 404 errors can occur after deactivating the AMP plugin, let’s dive into the solutions to resolve this issue:

1. Flush Permalinks:

The first step is to flush the permalinks on your WordPress website. This helps to regenerate the rewrite rules and ensures that your server can correctly route requests to the appropriate pages.

How to do it:

  1. Log in to your WordPress admin dashboard.
  2. Navigate to Settings > Permalinks.
  3. Without making any changes, click the “Save Changes” button. This action will flush and regenerate the permalink structure.

2. Clear Cache:

Clearing your website’s cache is crucial after deactivating the AMP plugin. This prevents the server from serving outdated or incorrect cached content.

How to do it:

  1. If you’re using a caching plugin, such as W3 Total Cache or WP Super Cache, navigate to the plugin’s settings and clear the cache.
  2. If you’re using server-side caching, you might need to access your hosting control panel or get in touch with your hosting provider to clear the cache.

3. Update Internal Links:

After deactivating the AMP plugin, any internal links that pointed to the AMP version of your pages need to be updated to the non-AMP versions.

How to do it:

  1. Identify the pages with outdated links. You can use tools like Screaming Frog or manually go through your content.
  2. Edit the internal links to point to the non-AMP URLs.

4. Implement 404 Redirects:

To ensure a seamless transition for users and search engines, set up 404 redirects from the old AMP URLs to their corresponding non-AMP URLs.

How to do it:

  1. Depending on your website setup, you can implement 301 redirects using a plugin like “Redirection” or by adding redirect rules to your .htaccess file.
  2. Test the redirects to ensure they are working as expected.

In the .htaccess field add AMP to Non-AMP path redirection rule.

Add and Save changes.

<IfModule mod_headers.c>
# Redirect from AMP to non-AMP path
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)/amp(.*)$
RewriteCond %{REQUEST_URI} !^/wp-content/(.*)$
RewriteRule ^ %1/ [R=301,L]
</IfModule>

5. Check Database Changes:

Deactivating the AMP plugin might involve changes to your database. Check if any metadata related to AMP is still present in your database and clean it up if necessary.

How to do it:

  1. Before making any changes to your database, ensure you have a backup.
  2. If you’re comfortable with database management, you can use tools like phpMyAdmin to search for and remove any residual AMP-related data.

6. Fetch as Google:

To expedite the reindexing of your updated pages by search engines, use the “Fetch as Google” feature in Google Search Console.

How to do it:

  1. Log in to Google Search Console.
  2. Select your property and navigate to URL Inspection.
  3. Enter the URL of a page that previously had an AMP version and request indexing. This notifies Google to crawl and index the updated page.

7. Monitor and Test:

After implementing the above steps, closely monitor your website for any remaining 404 errors. Test different pages and devices to ensure that users are not encountering any issues.

Also Read: How to Increase Internet Speed on Windows 10

Conclusion

Deactivating the AMP plugin can lead to 404 errors on previously functional AMP pages due to changes in website structure and cached content. It’s essential to take proactive measures to fix these errors and ensure a smooth user experience. By flushing permalinks, clearing cache, updating internal links, implementing redirects, checking database changes, using Google Search Console’s tools, and continuous monitoring, you can effectively resolve 404 errors and maintain the integrity of your website. Remember, providing a seamless browsing experience is paramount in retaining visitors and sustaining your online presence.