How to set redirects after disabling Google AMP in WordPress

When you disable Google AMP, you need to set redirects for SEO. Otherwise, visitors will encounter 404 error when clicking old amp pages which have been removed.

You can add the following code to .htaccess to set redirects.

# Redirect from AMP to non-AMP path
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)/amp(.*)$
RewriteRule ^ %1/ [R=301,L]
// Source: https://stackoverflow.com/questions/41733666/htaccess-to-remove-amp-from-the-end-of-a-url

Now, a link such as "www.example.com/permalink/amp" will be redirected to "www.example.com/permalink."

Sometimes, the above code will not work properly. I tested it with on a WordPress site installed on SiteGround but it did not work. It's possible to set redirects using a plugin. I installed Simple 301 Redirects and added the following redirections under Settings > 301 Redirects in Dashboard.

Set 301 Redirects using Simple 301 Redirects plugin in WordPress

The option "Use Wildcards?" needs to be checked. Now the redirections will work as expected.

When using Bluehost or SiteGround, it's possible to set redirects from cPanel. If it's not working, you can try to set 301 redirects using a plugin such as Simple 301 Redirects as described above.

For your reference, if you sign up for a service by clicking on the referral links in this post, I will get some commission. However, I do not recommend a specific webhosting service provider just for commission. I’ve been managing some WordPress sites from several webhosting services including Siteground and Bluehost for years (This blog is hosted with Bluehost VPS.)

Most especially, if you sign up for Bluehost's Shared Hosting by clicking on this link, you can get one dollar discount per month.


3s