0

I make a multilanguage web. I change language dynamically with php. When user click on any language from dropdown box, they call translated file (lang.eng.php, lang.es.php, lang.de.php etc.) Default language is English. this is how my dropdown looks

<ul>
<li><a href="/en/<?= $page ?>"><span class="flag-icon flag-icon-us"></span> English</a></li>
<li><a href="/fr/<?= $page ?>"><span class="flag-icon flag-icon-fr"></span> French</a></li>
<li><a href="/es/<?= $page ?>"><span class="flag-icon flag-icon-es"></span> Spanish</a></li>
<li><a href="/it/<?= $page ?>"><span class="flag-icon flag-icon-it"></span> Italian</a></li>
<li><a href="/hr/<?= $page ?>"><span class="flag-icon flag-icon-hr"></span> Croatian</a></li>
<li><a href="/de/<?= $page ?>"><span class="flag-icon flag-icon-de"></span> German</a></li>

hint: $page = opened_state

With .htaccess I change params www.ssss.com/en/index?$page?=en to www.ssss.com/en/index or www.ssss.com/fr/about etc. depending of selected state.

In every .php on my web page (index.php, about.php, contact.php etc) in <head></head> I set

<link rel="alternate" href and hreflang>

index.php
<link rel="alternate" href="https://ssss.com/en/index/" hreflang="en">
<link rel="alternate" href="https://ssss.com/fr/index/" hreflang="fr">
<link rel="alternate" href="https://ssss.com/de/index/" hreflang="de">

about.php
<link rel="alternate" href="https://ssss.com/en/about/" hreflang="en">
<link rel="alternate" href="https://ssss.com/fr/about/" hreflang="fr">
<link rel="alternate" href="https://ssss.com/de/about/" hreflang="de">

etc.

Every one of this links working nice when navigating on web page.

Is this ok for Google SEO optimization on all language on my web page?

When I try to generate site-map with online generator I only get /en/ links

Do you have any suggestion? Does google see all of my languages in this way?

Thnx

1

Based on how I'm reading your post, it all looks good to me. If a user selects their language your htaccess redirects them to the correct language directory. Google should be able to crawl all of these links and discover the different languages on your pages.

I recommend that you fetch your alternate language pages with Google fetch and render tool. This is a pretty essential standard to see how Google views your page. The rendered image output will tell you what language Google reads your links in.

https://search.google.com/test/mobile-friendly?utm_source=gws https://www.google.com/webmasters/tools/googlebot-fetch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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