2

We want translate our .com site, and decided to use different country specific top-level domain names, like:

  • www.mywebsite.com
  • www.monsiteweb.fr
  • www.misitioweb.es
  • ...

Now, from a maintenance perspective, we prefer to use the same host AND page for all languages. So, for example, every top level domain will link to the exact same index.php file, and we'll just check the top level domain in PHP and fetch the correct language from the database.

If we want to change the layout a bit, we only need to change one file (index.php), and not a file per language, that's a bit the idea. The same goes for all our other .php pages on our host.

My question is: how should I do the HTML-tagging properly with this set up? Should I just include all the tags in the same .php file, like so?

<head>
  <title>Widgets, Inc</title>
  <link rel="alternate" hreflang="en"
        href="http://www.mywebsite.com" />
  <link rel="alternate" hreflang="fr"
        href="www.monsiteweb.fr" />
  <link rel="alternate" hreflang="es"
        href="www.misitioweb.es" />
  <link rel="alternate" hreflang="x-default"
        href="http://www.mywebsite.com" />
</head>

And for other pages:

<head>
  <title>Widgets, Inc</title>
  <link rel="alternate" hreflang="en"
        href="http://www.mywebsite.com/about.php" />
  <link rel="alternate" hreflang="fr"
        href="www.monsiteweb.fr/about.php" />
  <link rel="alternate" hreflang="es"
        href="www.misitioweb.es/about.php" />
  <link rel="alternate" hreflang="x-default"
        href="http://www.mywebsite.com/about.php" />
</head>

Because this page says: "If two pages don't both point to each other, the tags will be ignored. This is so that someone on another site can't arbitrarily create a tag naming itself as an alternative version of one of your pages."

And in our case, it's not that "two pages" are pointing to each other, because it's only one page.

So... What's to proper way to do here?

1
  • They are separate pages. They are just powered by the same source code file. Commented Feb 15, 2019 at 10:39

1 Answer 1

1

The outside world sees them as two pages. they have different URLs and different content. It does not matter how you generate the pages content.

Your hreflang examples look fine. You can use the old Google Search Consoles international targeting section to check things once Google has re-crawled the sites.

6
  • Thanks for your reply! What about pages we don't have a translation for (yet)? We were thinking about just displaying a message "This page isn't available in your language yet" and show the English text, but not sure how this will be perceived by google, because they might see this page as a copy of the English version.
    – binoculars
    Commented Feb 26, 2019 at 16:47
  • I'd probably remove the page and hreflangs to it. Let Google send people to the English version in the first place. Commented Feb 26, 2019 at 23:44
  • Yes, but from a maintenance perspective, it's easier to keep the page. For example, otherwise navigation can't be generic. But I assume google will just see the English version as canonical then. That's fine. I just want to avoid any penalties by Google resulting in a drop in Google search.
    – binoculars
    Commented Feb 27, 2019 at 7:20
  • It should not cause any penalties. It should be fine for usability as well. It may even be a way for you to prioritise what you do get translated. Commented Feb 28, 2019 at 8:06
  • OK, great! So how do I set up my new domains? Aliases/parked domains or addon domains? Or is there a better way to point domains to the same hosting? I want all my domains to be indexable by Google of course.
    – binoculars
    Commented Mar 2, 2019 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.