Hot answers tagged

2

What I do for pages that I want to mark as canonical is put the following code in my header.php file that is loaded on each page: <link rel='canonical' href='<?php echo 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>'> This loads the prefix https:// plus the domain www.example.com plus the page page.php resulting in <link ...


1

Check your .htaccess for the redirections. I suppose it is an internal redirection made by WordPress. You can try this in the .htaccess. Make sure to have mod_rewrite activated in your server. RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ RewriteCond %{HTTPS} off RewriteRule ^(.*) https://www.example.com/$1 [QSA,L,R=301]


Only top voted, non community-wiki answers of a minimum length are eligible