Composr : mirror site, canonical name fix

Let us talk about scripts, HTML, Perl, PHP, apache, etc.
Post Reply
User avatar
Stevyn
SysOp
Posts:1786
Joined:Mon Nov 09, 2009 10:03 am
Location:Japan
Contact:
Composr : mirror site, canonical name fix

Post by Stevyn » Tue May 07, 2019 7:39 pm

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
Contact me directly: Ironfeatherbooks (@) gmail.com

Image

User avatar
Stevyn
SysOp
Posts:1786
Joined:Mon Nov 09, 2009 10:03 am
Location:Japan
Contact:

Re: Composr : mirror site, canonical name fix

Post by Stevyn » Sat May 11, 2019 12:47 pm

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;
}


Contact me directly: Ironfeatherbooks (@) gmail.com

Image

Post Reply