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

A very useful tutorial in which you learn how to redirect AMP pages to non-AMP ones after deactivating the AMP plugin for WordPress. Practically eliminate "/amp” from the end of URLs.

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. Conceived as a project to make the web faster and to provide users with a simplified interface of accessed pages, AMP was not to the liking of all webmasters who installed and used it for a while. WordPress. Either they had a low conversion rate, or decreased traffic on mobile devices, or they were unable to properly implement 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 URLs with “/amp” will have simplified pages in terms of design and features, in accordance with the standards of the AMP project. The pages will 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 arises when for X reasons you decide to give up AMP for WordPress. Disable the AMP plugin for WordPress it's very simple. We go in Dashboard →   Plugins  click "Deactivate". In Google Search however, the URLs indexed with the ending "/amp" will remain, and when they are accessed they will return "Error 404 – Page Not Found". The link is no longer valid, in the Google Console you will notice a massive increase in pages "not found". Pages containing "/amp” at the end of the URL.

Redirect AMP pages to non-AMP.

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

Redirect AMP pages to non-AMP after disabling the AMP plugin for 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.

AMP redirection directives in .htaccess (Apache)

Apache use directives .htaccess. Edit the file .htaccess from the root folder of the domain and add the following lines:

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

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

Redirect AMP to non-AMP pages on severe with NGINX

To redirect pages AMP on non-AMP on servers with Nginx, you have to edit the file nginx.conf of the domain for which you want to do the redirection and add the line of rewrite in the segment "server { ..."

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

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

After the restart, all the URL ending with "/amp” will be redirected to the same URL without terminating the plugin AMP for WordPress.

Passionate about technology, I enjoy writing on StealthSettings.com since 2006. I have a rich experience in operating systems: macOS, Windows, and Linux, as well as in programming languages and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, PrestaShop).

How to » Web Hosting » Redirect AMP pages to non-AMP after disabling the AMP plugin for WordPress

2 thoughts on “Redirecting AMP pages to non-AMP pages after disabling the AMP plugin for WordPress"

  1. Excellent info, puedes ayudarme porque en mi caso solo quiero redirigir una página en specifico, no todas las que tengo. Cómo quedarían los codes para .htaccess y nginx? Gracias y quedo en espera de tu ayuda.

    Reply
Leave a Comment