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

Have you ever disabled AMP in your website and are getting an error from Google Search Console about “The referenced AMP URL just isn’t an AMP”?

Accelerated Cell Pages or generally often called AMP is an open-source internet element framework initially created by Google that you should use to simply create user-facing web sites, tales, emails, and advertisements.

Basically, it is a stripped-down model of an HTML web page, designed to be tremendous gentle and cargo rapidly. This platform is designed for velocity and readability together with heavy caching for cell units. Though, as a part of a latest Google announcement, they’re eradicating the AMP requirement from Prime Story’s eligibility.

When you plan to choose out of AMP, you may must disable the AMP plugin (if you happen to’re utilizing WordPress). However the issue is that serps like Google nonetheless level to your previous web page /amp on the finish and can attain your guests 404 - Web page Not Discovered incorrect.

otherwise you get an error like.

What’s the resolution after deactivating AMP to keep away from such errors?

Easy!

To keep away from this state of affairs, redirect such pages correctly after disabling AMP.

If you wish to redirect the AMP web page to a non-AMP web page, you have come to the fitting place as we focus on the steps you possibly can take to do this in in style internet servers and companies.

So let’s begin.

Nginx

Nginx configuration is saved in nginx.conf.

The file must be obtainable in /and so on/nginx or /and so on/nginx/conf.d on Linux servers (for an open supply model of NGINX, the situation could also be completely different, comparable to /usr/native/nginx/conf or /usr/native/and so on/nginx).

Edit the nginx.conf file that shops your website/area configuration the place you might want to allow AMP to non-AMP redirection and add the beneath rewrite rule within the server { block:

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

To interchange instance.com with your personal area and save the file. Restarting nginx server to make the redirect change efficient.

$ sudo systemctl restart nginx

Now you possibly can confirm out of your browser if the redirect is working.

Apache

Apache makes use of .htaccess tips. You need to use the .htaccess file on the root of your area and add the next AMP guidelines to the non-AMP redirect:

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

Save the adjustments .htaccess file and confirm the redirect out of your browser.

You may also use the above code on a shared internet hosting platform for WordPress or different CMS. In case you are undecided in regards to the .htaccess change, you possibly can contact your internet hosting supplier.

Cloud Flame

A lot simpler if you happen to use Cloudflare. You’ll be able to reap the benefits of the Guidelines, which one can find within the high icon bar after logging in.

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

That is what was finished for Geekflare.

Wait a number of seconds after which attempt to entry the AMP URL. You’ll discover that it redirects to a non-AMP web page.

Resume

We have given a quick introduction to AMP and why it is in use. Redirection from AMP to non-AMP is a vital step to carry out after disabling AMP to keep away from shedding guests to your website as a consequence of 404 errors. This may be simply achieved utilizing everlasting redirection, as talked about above.

Leave a Comment

porno izle altyazılı porno porno