Connect with us

News

AMP URL Rewriter Plugin: Rewrite amp urls [from /amp and /?amp] to non-amp

Published

on

 

 

  • AMP Rewriter Plugin
  • AMP Endpoint Removal plugin
  • How to install a WordPress plugin

Hello guys,

welcome to my blog, as you may already know me, I am Coker Hope Afe, proud owner of this blog (Naijatechnews.com) and today i will give you a permanet solution in fixing amp errors, perhaps as it has been reported through your Google search console (GSC). You don’t need to be scared or worried if you have no knowlege of coding or php because wordpress has made it easy for everyone to handle and resolve problems without prior knowledge of progamming. Wonderful right? Yes it is definitely.

 

So, I have developed a plugin to handle this issue and erase all urls (links) with /amp and /?amp to non amp which is the clean default url.

For instance: https://www.naijatechnews.com/dream-league-soccer-2021-mod-apk-dls-21-unlimited-coins/amp to https://www.naijatechnews.com/dream-league-soccer-2021-mod-apk-dls-21-unlimited-coins/

and

https://www.naijatechnews.com/dream-league-soccer-2021-mod-apk-dls-21-unlimited-coins/?amp to https://www.naijatechnews.com/dream-league-soccer-2021-mod-apk-dls-21-unlimited-coins

Isn’t that sweet ? yea! It is and you love it. It automatically redirect URLs with the /amp/ and /?amp query to normal URL. This is only useful when removing the AMP plugin. The plugin will do nothing, if the AMP plugin is active, I mean the plugin won’t work if you have the amp plugin activated. So be sure that you have deactivated the amp plugin first if haven’t done that already.

You may just flush your permalinks, if you experience any problems.

Check also: How to best resize a photo, all methods you need is here & Wordfence Security Premium v7.4.12 – Total Protection 

How to Redirect Without Plugin

Paste this code in your htaccess;

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

Or

RedirectMatch 301 ^/([^/]+)/?amp$ donain-url/$1

change website-url to your domain link

How to redirect AMP pages in bulk

If you want to redirect ALL your AMP pages in one go, we can use the same plugin as above and it’ll take literally 1 minute or so.

Step 1. Navigate to the Redirection plugin

Step 2. Set Regex option

Step 3. Input the proper URL expressions

Step 4. Add redirect

Navigate to the Redirection plugin using the same steps as in the above section.

 

This time, click on URL options/Regex.

 

Select Regex.

This time, in the Source URL, you need to add this expression ^/(.*?)/amp/$

 

In the Target URL input, this expression /$1/

Click “add redirect”, and you should be done!

Check to see if this worked by adding /amp/ to any of your articles and seeing if it auto-redirects. You can do the same on your mobile phone.

If this doesn’t work, your WP site might be using a different URL structure.

How To Install The Plugin

Instructions on how to install the AMP URL Rewriter WordPress plugin

There are two ways to do it:

  1. Installing via WordPress Admin
  2. Installing via FTP/Cpanel

Installing via WordPress admin

  • First, Download the Plugin from Here
  • Login to wordpreess admin dashboard.
  • Navigate to Plugins > Add new.
  • Click on the Select files from device.
  • Tap on Upload
  • Then Activate after successfully uploaded

 

That’s done.

See also: How to Protect WordPress Themes Wp-content from Hack

Installing via FTP/CPANEL

  1. First, Download the Plugin from Here
  2. Login to ftp or your cpanel or hosting account > cpanel/ftp filemanager
  3.  cpanel > Public_html > Wp-content > plugins
  4.  Upload the AMP URL Rewriter WordPress plugin you have downloaded
  5.  After successfully uploaded, then Extract the file because it’s in zip file
  6. Then activate the plugin  via the WordPress admin  (e.g. wp plugin activate).

Done.

Hope you enjoy the tutorial? share

Continue Reading
Click to comment

Leave a Reply

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