What is the best SEO practice when I use an alias server?

Operating system: Ubuntu
OS version: 18.04

My main site is music-school.mysite.com, for users’ convenience I also create an alias virtual server as ms.mysite.com

Is this a good practice when it comes to SEO? Does google treat them as two different sites? Is there anything I can do in Google Search Console or Analytics to negate the impact?

Yes, Google treats them as different sites. They also treat the www and non-www URL’s as different sites (rather stupidly, in my opinion).

If you’re using Apache, you can use the .htaccess file to rewrite the URL to the canonical one; and then define the canonical URL in the page headers. I do this in PHP as

  $canonical_domain = "https://example.tld";
  $canonical = $canonical_domain . "/" . basename($_SERVER['PHP_SELF']);

in the header script. then

<link rel="canonical" href="<?php echo $canonical ?>">

in the <head>.



Thanks for the info.
I am still wondering how GA treated them as different site.
If GA’s javascript code finds the URL is different from the GA property’s URL, will it ignore the data at all?
It seems not.
My property’s URL is music-schoo.mysite.com, just now I did a test: using incognito mode I open ms.mysite.com/test.php, and then I check GA active user. I was able to see an active user is visiting /test.php, there is no other active users. So GA does record my behavior even though I am visiting the alias URL.

So how does Google’s “treating them as different sites” affect my GA data?

Sorry, but I really don’t know. I don’t use GA. I’m not a big Google fan. I just try to work around their idiocy without having to actually interact with them.

If you’re doing server-side rewrites on the alias, for example, the GA script will load from the rewritten URL; so the alias should have zero traffic as far as GA is concerned. Their script will never run on the alias because it’s being rewritten to the main site.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.