Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

New 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]


1

I got exactly same problem when deploy HA Wordpress on EC2 Apache web server under auto scaling group when spin up new EC2 Apache web server. 1. At first I think there are problem with apache web server: sudo vim /var/log/httpd/error_log [Tue Nov 05 ] [core:notice] [pid 2914] AH00094: Command line: '/usr/sbin/httpd' [Tue Nov 05 ] [mpm_prefork:notice] [pid ...


0

You can set your canonical to be the current page URL. According to Get the full URL in PHP on stackoverflow.com, you just need to initiate your $canonical variable like: $canonical = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; Maybe right where your $title ...


2

Well... I fixed it! But as it usually goes, I'm unsure of the exact thing that put it together. However, I will leave what I did over here, in hopes that it might help someone else in the future. From cPanel, I first changed my php version from 7.2 to 7.1. And it crashed my website. Therefore, I changed it back to 7.2, and voila! It simply works.


Top 50 recent answers are included