How to gracefully disable or remove AMP Pages from WordPress Site

Introduction

This tutorial will show you how to disable or remove AMP gracefully from your WordPress site or blog. AMP is an acronym and stands for Accelerated Mobile Page.

AMP is an initiative to create web pages that load quickly on the mobile devices. It consists of a modified version of HTML called AMP HTML, a JavaScript library called AMP JS and a caching library. The AMP project is open source and was originally developed by Google.

Pros of AMP Pages

  • If majority of your audience are mobile users then you may go for AMP pages.
  • AMP pages are faster because AMP uses restrictive set of HTML/JavaScript (JS).

Cons of AMP Pages

  • AMP uses restrictive set of HTML/JavaScript (JS). So site owners cannot encourage users to subscribe, fill out contact form or buy stuffs.
  • AMP does not show navigation, sidebar menus. So it causes significant drop in page views by mobile users.
  • Site users cannot fill comment form.
  • If you are using OnePress social locker to lock your premium content then free version of this plugin does not show your locked content.
  • AMP increases extra page design efforts and you can use this effort to write article for making money. Also Google AdSense does not perform well on AMP pages.
  • The AMP plugin may have security issues or bugs and it is always better to make page faster by doing the required actions.
  • Google’s main job is to display results from your site and it does not consider AMP pages for ranking factor.

Disable or Remove AMP Pages

There are mainly two ways to properly disable AMP on your site.

First approach is to remove the link rel="amphtml" from the pages and setup NOINDEX for the pages.

Second approach is to disable the AMP plugin and setup redirect to non-AMP pages.

Now we will discuss about the two approaches we have mentioned above.

First Approach

Remove rel=”amphtml” from AMP Pages

We need to remove rel="amphtml" from the head of the pages in web site. You can find this string on view source of your web pages. We can do this by going to every page of the WordPress HTML output and replace but it would be very complex to manage so many pages in a web site.

So we have most useful plugin called Real Time Find and Replace. This plugin allows you to dynamically (i.e. at the time when a page is generated) replace code and text from themes and other plugins with code and text of your choosing before a page is delivered to a user’s browser.

disable amp gracefully in wordpress
  • Go to Tools -> Real-Time Find and Replace
disable amp gracefully in wordpress
  • Put the below regular expression (regex) pattern in the left side box (Find:) and leave blank on the right side box (Replace With:)
<link rel="amphtml" href="(.+)" >
  • Now check Use RegEx checkbox
disable amp gracefully in wordpress
  • Finally click on Update Settings button. That’s all.

Check NOINDEX Status

Go to Google.com page and search like https://roytuts.com/*/amp/

Important Note: Please do not remove AMP plugin from your installed plugins list at this moment. You need to keep the AMP plugin till you see no AMP page in Google search result.

Setup NOINDEX for AMP Pages

Open Accelerated Mobile Pages plugin and click on Settings:

disable amp gracefully in wordpress

Click on SEO. Under Head Section put the below line:

<meta name="robots" content="noindex,follow"/>
disable amp gracefully in wordpress

Second Approach

Disable AMP Plugin

We will first disable Accelerated Mobile Pages plugin by clicking on Deactivate link.

disable amp gracefully in wordpress

Setup Redirects

Net we will setup redirects for AMP pages otherwise Google Webmaster Tools will show 404 errors for AMP pages.

Put the following lines into your .htaccess file for Apache server:

RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)/amp(.*)$
RewriteRule ^ %1/ [R=301,L]

If you are using Nginx server then you can use the following rule in /etc/nginx/nginx.conf or your nginx server configuration file under server {...} block.

server {
    ...
    rewrite (.+)/amp(.*)$ http://domain.com/$1 permanent;
    ...
}  

You can also use plugin to setup redirects. You can search in Google and will find few plugins for page redirection.

Check NONINDEX Status

You can do the same search for your AMP page status in google.com.

Remember it will take few weeks for Google to remove the AMP pages from search results.

For me it still is in progress, look at the below images, I started on 5th May and as of today (16th May) it is just 105 from 839 AMP pages.

5th May AMP Index Status

disable amp gracefully in wordpress

16th May AMP Index Status

disable amp gracefully in wordpress

For me in Google search results, still I have AMP page:

disable amp gracefully in wordpress

Hopefully I will get 0 AMP page in Google search result.

Thanks for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *