0

I have url like the follow: http://new2.silentdivers.com/links.php?lang=en

What will be the best way to do SEO freindly URL? Any help needed.

lang=en could be, lang=ge, lang=fr etc

Simon Vetterli
  • 161
  • 3
  • 13
  • This is not a programming question and it is off-topic on Stack Overflow. Non-programming questions about your website should be asked on [webmasters.se]. In this case the question has already been asked and answered there: [How should I structure my URLs for both SEO and localization?](https://webmasters.stackexchange.com/questions/403/how-should-i-structure-my-urls-for-both-seo-and-localization) – Stephen Ostermiller May 24 '22 at 07:45

1 Answers1

4

In my opinion the most important thing is that you need to understand that language should be only URL(and/or domain) based. Meaning URL I mean your script should always check only url and take decision what language is chosen. Many people misunderstand it and use cookies or sessions to check them and to choose language and it's a huge mistake for SEO.

There are 3 methods of making multilingual site. In my opinion and based on my experience as SEO expert any other won't be in fact SEO friendly

Method 1

domain.com
domain.com/lang2/
domain.com/lang3/
domain.comm/article
domain.com/lang2/article
domain.com/lang3/article

In this method you always check lang prefix after domain. If there is no prefix you display default language. It's the easiest method to implement and will work almost everywhere

Method 2

  domain.com
  domain.com/article
  lang2.domain.com
  lang2.domain.com/article
  lang3.domain.com
  lang3.domain.com/article 

In this method you always need to check subdomain do determine language. Pros are that you can do SEO for subdomains (many directories don't accept domain.com/lang2/ but will accept lang2.domain.com )

Method 3

domain.com
domain.com/article
domainforlang2.com
domainforlang2.com/article
domainforlang3.com
domainforlang3.com/article

This method will be for bigger sites when you really need different domains. Disadvantage may be sometimes it's hard to find nice domain for each language

In above examples article can be anything but in fact this part should be also translated. So for example in method 1 for english language you can have domain.com/en/links/ and domain.com/pl/linki (linki is Polish translation for English word "links")

Also domain.com is only example. It can be domain.net , domain.org or any other domain.

You have to choose method on your own. For small sites method 1 and 2 are enough (2nd method for more SEO activities will be better)

EDIT

For method1 you can use this .htaccess :

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)(.*)/?$ index.php

and in PHP you should simple check value of $_SERVER['REQUEST_URI']

In this case if it begins with lang2/ or lang3/ it means that's the selected language, otherwise default language is set.

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
  • Hi If I like to go for method 1, how I do this in htaccess? Can You give me an example? – Simon Vetterli Jun 14 '14 at 01:53
  • Hi So, my htaccess should be like this: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*)(.*)/?$ index.php RewriteRule (.*)(.*)/?$ openwaterdiver.php RewriteRule (.*)(.*)/?$ contact.php And more lines with every file I have? – Simon Vetterli Jun 15 '14 at 10:27
  • No, you should have only one main file in your application - index.php , it should parse `$_SERVER['REQUEST_URI']` and then launch required controllers depending on url – Marcin Nabiałek Jun 15 '14 at 11:23
  • Method 2 and method 3 have the downside that any SEO impact (from backlings, old crawlers etc) from domain.com will have no effect for `domainforlang2.com` or `lang2.domain.com` and the other way around. And there is of course the downside of costs for multiple domains and multiple SSL certificates. – Adam Sep 16 '18 at 19:31