Forward AMP pages to non-AMP after disabling the AMP plugin for WordPress

project AMP (Accelerated Mobile Pages) was designed to help users benefit from Internet connection the weaker (3G) can quickly access web pages on Mobile Phones si smartphones.
Both bloggers and large websites have incept to use this structured format for mobile webpages, but many wanted after a while quit the AMP. Designed as a project to make the web faster and to provide users with a simplified interface for the pages accessed, AMP did not like the webmasters who installed and used it for a while on WordPress. Either they had a low conversion rate, either decreased traffic from mobile devices, or they could not correctly implement their ad networks Google AdSense and others.
What is certain is that Google encourages the use of AMP and warns webmasters that in the future it is possible that websites without AMP will not receive too many visitors from mobile devices.

If you have come to this article, most likely you used AMP for a while, you are disabled AMP plugin for WordPress and now you are confronted with many 404 pages in Google Console.
After activating the AMP plug-in for WordPress, URLs pages and Articles they will have the termination "/ amp". These “/ amp” URLs will have simplified pages in terms of design and features, in accordance with AMP project standards. The pages will also be indexed with the new URL in Google Search, then served to users when they search for something relevant to reach your website page.

The problem occurs when you decide to drop the WordPress AMP for X reasons. Disable the AMP plugin for WordPress it is very simple. We're going in Dashboard →   Plugins → click “Deactivate". In Google Search, however, the URLs with the termination "/ amp" will remain, and when they are accessed, they will returnError 404 - Page Not Found". As the link is no longer valid, in Google Console you will find a massive increase in "not found" pages. Pages that contain "/ amp" at the end of the URL.

The most elegant solution is that after disabling the plugin on its Dashboard permanently redirected (Redirect 301) “/ Amp” URLs to their normal version. Without “/ amp”.

How to permanently redirect a AMP link to a non-AMP link in WordPress

We take the scenario in which we have web pages of the form: “http://domeniu.com/nume-post/amp"And we want to redirect them to"http://numedomeniu.com/nume-post/".

It still depends on what web server you are using. Apache or NGINX.

How to permanently redirect a link that ends with "/ amp" to a non-AMP link on Apache

Apache uses the .htacces directives. Edit the .htaccess file in the root of the domain and add the following lines:

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

Save the .htaccess file and check in the browser by accessing a former "/ amp" page.

NGINX - redirect “/ amp” to the non-AMP page of the article

Edit the nginx.conf file of the domain for which you want to redirect and add the rewrite line in the "server {…" segment:

rewrite ^/(.*)\/amp http://numedomeniu.com/$1 permanent;

Save the file and restart the "nginx" service on the server.

After restarting, all URLs ending in "/ amp" will be redirected to the same URL without the termination of the AMP plugin for WordPress.

Forward AMP pages to non-AMP after disabling the AMP plugin for WordPress

About the author

Stealth

Passionate about everything gadget and IT, I write with pleasure on stealthsettings.com since 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Leave a Comment