How to Redirect AMP Page to Non-AMP in Nginx, Apache, Cloudflare?

[ad_1]

Have you ever disabled AMP in your web site and were given an error from Google Seek Console about “Referenced AMP URL isn’t an AMP”?

Sped up Mobile Pages or repeatedly referred to as AMP is an open-source internet part framework at the beginning created by means of Google which you need to use to simply create user-first internet sites, tales, emails, and commercials.

Essentially, it’s a stripped-down model of an HTML web page designed to be tremendous light-weight and for quick loading. This platform is designed for pace and clarity together with heavy caching for cellular units. Despite the fact that as a part of a contemporary announcement by means of Google, they’re doing away with the AMP requirement from Best Storie’s eligibility.

Should you plan to opt-out of AMP you’ve to disable the AMP plugin (if the use of WordPress). However the issue is engines like google like Google will nonetheless be pointing to your outdated web page with /amp on the finish and can land your guests to 404 - Page No longer Discovered error.

or, you’re going to get an error like.

So, what’s the answer after deactivating AMP to steer clear of such mistakes?

Simple!

You want to correctly redirect such pages after disabling AMP to steer clear of this situation.

For those who’re searching for redirecting the AMP web page to a non-AMP one, you’re on the proper position as we’ll be discussing steps that you’ll take to do this in well-liked internet servers and services and products.

So let’s get began.

Nginx

Nginx configuration is saved in nginx.conf.

The document must be to be had in /and many others/nginx or /and many others/nginx/conf.d on Linux servers (for an open-source model of NGINX, the site might range like /usr/native/nginx/conf or /usr/native/and many others/nginx).

Edit the nginx.conf document the place your web site’s/area’s configuration is saved the place you wish to have to permit AMP to non-AMP redirection and upload beneath rewrite line in the server { block:

rewrite ^/(.*)/amp http://instance.com/$1 everlasting;

Exchange instance.com with your individual area and save the document. Restart nginx server to make the redirection trade efficient.

$ sudo systemctl restart nginx

Now you’ll test if redirection is operating out of your browser.

Apache

Apache used .htaccess directives. You’ll be able to edit the .htaccess document in the basis of your area and upload the next traces for AMP to the non-AMP redirection:

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

Save the adjustments to .htaccess document and test redirection out of your browser.

Cloudflare

A lot more uncomplicated, in case you are the use of Cloudflare. You’ll be able to benefit from Regulations, which you in finding at the best icons bar after login.

  • You’ll be able to have an identical URL as beneath.
https://instance.com/*/amp/
  • Settings as Forwarding URL with 301 and vacation spot URL as beneath.
https://geekflare.com/$1

That is what was once completed for Geekflare.

Look ahead to few seconds after which check out to get admission to the AMP URL and you’re going to realize it’s getting redirected to a non-AMP web page.

Abstract

We’ve lined a short lived advent about AMP and why it’s been in use. AMP to non-AMP redirection is an crucial step to be completed submit disabling AMP to steer clear of shedding out in your web site guests due to 404 mistakes. This can also be simply accomplished the use of everlasting redirection as discussed above.

[ad_2]

Related Articles

Leave a Reply

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

Back to top button