WordPress

Not Verified URL Following Links in Newsletters

By February 16, 2019 No Comments

If you’re experiencing the “Not verified URL” error message when you open a tracked link from emails sent by Newsletter plugin, probably there is a HTTP->HTTPS redirect problem which broke the link (easy to fix).

Blogs switching to HTTPS usually add a rule in their .htaccess file to redirect all the old traffic coming from HTTP to HTTPS. A rule could look like:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

The rule is not correct even if suggested by many sites. What is missing there is the “NE” flag. Without the NE flag added to the rule, a double encoding happens and if you have an URL with encoded query string, it ends to be broken.

For example, an URL like http://www.example.com?p=%3D which is a correct encoded URL, after that rule becomes https://www.example.com?p=%253D which is totally wrong. It should be changed only in the protocol part and becomeĀ https://www.example.com?p=%3D.

To fix that the rule should be changed to:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]

where you can note the NE flag has been added (which actually means “do not re-encode”). Side note: someone reported the flag order seems to be important. More about RewriteRule flags here.

Then remember to change in your blog main settings the home url and site url options to use HTTPS otherwise the links generated by WordPress will always use HTTP.

Usually blog owners do not face this problem is they use only permalink without any parameters. Anyway we’re in the process to encode in a different way the link to avoid even those kind of problems.

References