Page 1 of 1

Composr : mirror site, canonical name fix

Posted: Tue May 07, 2019 7:39 pm
by Stevyn
according to yoast for good SEO you should have the mirror website canonical link element set up...

https://yoast.com/rel-canonical/

composr automatically sets up the canonical link in the header which is great for your main website but for the mirror you can replace the subdomain (for example it is mirror.example.com)

Code: Select all


<link rel="canonical" href="{$REPLACE,//mirror.,//,{$CANONICAL_URL*}}" />
this will strip out the subdomain "mirror" so now both sites will display the main URL as canonical link

Re: Composr : mirror site, canonical name fix

Posted: Sat May 11, 2019 12:47 pm
by Stevyn
Chris Graham adds:

As a note, usually during development I'll write code in _config.php to put out different settings based on hostname, like:

Code: Select all

switch (gethostname()) {
   case 'some-host':
      break;

   case 'some-other-host':
      break;
}