Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2008
    Posts
    214
    Thanks
    5
    Thanked 22 Times in 22 Posts

    Help with SEO for multilingual website

    Hello all!

    I made a multilingual PHP website framework. The framework serve the HTML "container" (the visual template of the site) and the page serve the content (in the current language).

    I use the following to determine the current language:
    1) $_GET['lang'] if set.
    2) $_SESSION variable if set.
    3) $_COOKIE if set.
    4) Default language (English).

    The user can change the language anytime on any page.

    All the languages are in the same file. For example, index.php can be served in English, French, German...

    This setup is very easy to maintain since if you change the visual template (the container), all the pages of the site will be updated at once. Same thing with the content... For example, you set the content layout of index.php once and then edit the content for each language.

    My setup has one problem... It's not very SEO oriented (yet). Since www.foo.net/index.php can be served in many languages, Google and friends only index my pages in the default language.

    Now I want to implement SEO URLs. So far my system support language overrides: if the session is set to French and that you type index.php?lang=en the page will be served in English instead of French.

    I would like to use something like:
    www.foo.net/en/index.php
    www.foo.net/fr/index.php

    I know it's doable with .htaccess (I think) but I would like to know how to do it... I would like to avoid redirect things since I don't want to "break" the back button.

    Many thanks for your thoughts/hints!

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    http://www.skybyte.net/articles/mod_rewrite/

    Here is a link with some information, I'm no expert with all of the ways to do it, but it should give you a start.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by TheWolf1 View Post
    Hello all!

    I made a multilingual PHP website framework. The framework serve the HTML "container" (the visual template of the site) and the page serve the content (in the current language).
    if you use apache this could help you:

    http://httpd.apache.org/docs/2.2/con...gotiation.html

    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •