How to blanket redirect AMP URLs in Apache .htaccess

Posted on: October 21, 2022

Written by: Mick Sherry

If you’ve removed Accelarated Mobile Pages (AMP) from your website or blog, you may need to redirect all the old /amp/ URLs back to the original, non-AMP URL.

To do this automatically, add this line to the .htacces file on your apache server:

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

This will blanket redirect all AMP URLs back to the original non-AMP URL.

Note: Only advanced users should modify their .htaccess file. If you are unsure, send a support ticket to your hosting company and ask them to implement this for you.

If your website is running on WordPress, here is a safer and more user-friendly way you can redirect all /amp/ URLs to their original URL across your site.


AMP Redirect in a .htaccess File – Example

Example implementation in a WordPres .htacces file below:

This snippet will work on any CMS (including WordPress) as long as your webserver is running on apache.


Why would you need to redirect AMP pages?

This is a quick/useful way to redirect your old AMP URLs and avoid 404 errors or crawl errors in Google Search Console.

You will need to do this if you’ve previously used AMP on your website you’ve recently decided to disable or remove it.

Click-To-Call Send Message