Multi language site with PHP, mysql and cookies - how about search engines?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • CAH

    Multi language site with PHP, mysql and cookies - how about search engines?

    Hi

    I need to make at multilanguage language site, and for that I need to
    identify the users, and register there choice off language. For that i
    imagine using cookies, since this is the only way to identify the
    users. But from what I read search engines ignore cookies, and at the
    same time I would like the users to be able to send links in there
    choice of language to there friends, so I would like this sort of url
    scheme.

    Agentforce 360 Platform (Formerly Salesforce Platform) powers the Agentic Enterprise, combining metadata, governance, MuleSoft and Data Cloud.

    Agentforce 360 Platform (Formerly Salesforce Platform) powers the Agentic Enterprise, combining metadata, governance, MuleSoft and Data Cloud.

    Agentforce 360 Platform (Formerly Salesforce Platform) powers the Agentic Enterprise, combining metadata, governance, MuleSoft and Data Cloud.

    .....

    But I don´t like the idea of having a lot of duplicate files, with the
    only difference being a reference to a specific column in my sql
    database. What to do? How do others solve these problems?

    Thanks for any advice
    CAH
    PS There is no reason to set up some sort of login, it would be to big
    a burden on the user for this kind of site.)


  • Erwin Moller

    #2
    Re: Multi language site with PHP, mysql and cookies - how about search engines?

    CAH wrote:
    Hi
    >
    I need to make at multilanguage language site, and for that I need to
    identify the users, and register there choice off language. For that i
    imagine using cookies, since this is the only way to identify the
    users. But from what I read search engines ignore cookies, and at the
    same time I would like the users to be able to send links in there
    choice of language to there friends, so I would like this sort of url
    scheme.
    >
    Agentforce 360 Platform (Formerly Salesforce Platform) powers the Agentic Enterprise, combining metadata, governance, MuleSoft and Data Cloud.

    Agentforce 360 Platform (Formerly Salesforce Platform) powers the Agentic Enterprise, combining metadata, governance, MuleSoft and Data Cloud.

    Agentforce 360 Platform (Formerly Salesforce Platform) powers the Agentic Enterprise, combining metadata, governance, MuleSoft and Data Cloud.

    ....
    >
    But I don´t like the idea of having a lot of duplicate files, with the
    only difference being a reference to a specific column in my sql
    database. What to do? How do others solve these problems?
    With mod_rewrite.

    With that you can setup Apache to do this:
    1) incoming URL:
    Agentforce 360 Platform (Formerly Salesforce Platform) powers the Agentic Enterprise, combining metadata, governance, MuleSoft and Data Cloud.

    to
    Agentforce 360 Platform (Formerly Salesforce Platform) powers the Agentic Enterprise, combining metadata, governance, MuleSoft and Data Cloud.


    You can set up your own rules (using regular expression).

    In that way you do not have to really create all these pages, but they
    become virtual.
    You only have to make page1.php pick up the $_GET["lang"] and make decisions
    for your query based on that.


    Regards,
    Erwin Moller
    >
    Thanks for any advice
    CAH
    PS There is no reason to set up some sort of login, it would be to big
    a burden on the user for this kind of site.)
    www.winches.dk

    Comment

    • CAH

      #3
      Re: Multi language site with PHP, mysql and cookies - how about search engines?

      With mod_rewrite.
      >
      With that you can setup Apache to do this:
      1) incoming URL:www.site.com/en/page1.php
      towww.site.com/page1.php?lang= en
      >
      You can set up your own rules (using regular expression).
      >
      In that way you do not have to really create all these pages, but they
      become virtual.
      You only have to make page1.php pick up the $_GET["lang"] and make decisions
      for your query based on that.
      Excellent advice, can Google register that one uses mod_rewrite, or is
      it none the wiser? Can search engines have something agains this
      solution?

      Best regards
      Cah

      Comment

      • Erwin Moller

        #4
        Re: Multi language site with PHP, mysql and cookies - how about search engines?

        CAH wrote:
        >With mod_rewrite.
        >>
        >With that you can setup Apache to do this:
        >1) incoming URL:www.site.com/en/page1.php
        >towww.site.c om/page1.php?lang= en
        >>
        >You can set up your own rules (using regular expression).
        >>
        >In that way you do not have to really create all these pages, but they
        >become virtual.
        >You only have to make page1.php pick up the $_GET["lang"] and make
        >decisions for your query based on that.
        >
        Excellent advice, can Google register that one uses mod_rewrite, or is
        it none the wiser? Can search engines have something agains this
        solution?
        >
        Best regards
        Cah
        Hi,

        Searchengine don't know about any url-rewriting taking place.
        From a searchengine's point of view:
        1) Ask some URL (www.example.com)
        2) read all the hyperlinks
        3) follow a hyperlink, eg: www.example.com/en/page1.php
        4) Server responds with the HTML.
        etc

        The fact that the server in step 3 using URL rewriting (and actually uses
        www.example.com/page1.php?lang=en) is completely unknown to the searchbot.
        It is completely unknown to ANY client.
        It is just something between you and your friend Apache. ;-)

        Regards,
        Erwin Moller

        Comment

        • Toby A Inkster

          #5
          Re: Multi language site with PHP, mysql and cookies - how aboutsearch engines?

          CAH wrote:
          I need to make at multilanguage language site, and for that I need to
          identify the users, and register there choice off language.
          I urge you to also inspect the user's "Accept-Language" HTTP header to
          determine the default language to show them if they haven't already chosen
          a preferred language.

          This HTTP header is sent by virtually all web browsers and more often than
          not, indicates the user's preferred language.

          --
          Toby A Inkster BSc (Hons) ARCS
          Contact Me ~ http://tobyinkster.co.uk/contact
          Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

          * = I'm getting there!

          Comment

          • CAH

            #6
            Re: Multi language site with PHP, mysql and cookies - how about search engines?

            On Apr 10, 2:16 pm, Erwin Moller
            <since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
            CAH wrote:
            With mod_rewrite.
            >
            With that you can setup Apache to do this:
            1) incoming URL:www.site.com/en/page1.php
            towww.site.com/page1.php?lang= en
            >
            You can set up your own rules (using regular expression).
            >
            In that way you do not have to really create all these pages, but they
            become virtual.
            You only have to make page1.php pick up the $_GET["lang"] and make
            decisions for your query based on that.
            >
            Excellent advice, can Google register that one uses mod_rewrite, or is
            it none the wiser? Can search engines have something agains this
            solution?
            >
            Best regards
            Cah
            >
            Hi,
            >
            Searchengine don't know about any url-rewriting taking place.
            From a searchengine's point of view:
            1) Ask some URL (www.example.com)
            2) read all the hyperlinks
            3) follow a hyperlink, eg:www.example.com/en/page1.php
            4) Server responds with the HTML.
            etc
            >
            The fact that the server in step 3 using URL rewriting (and actually useswww.example .com/page1.php?lang= en) is completely unknown to the searchbot.
            It is completely unknown to ANY client.
            It is just something between you and your friend Apache. ;-)
            >
            Regards,
            Erwin Moller- Hide quoted text -
            >
            - Show quoted text -
            Hi Erwin

            It is indeed excellent, I am trying to figure this mod_rewrite out,
            and I have gotten it to work with simple request. But I guess it most
            be possible with just three lines in the htacces file. I would like
            anything in the /en/ directory to just be moved to the above level and
            have the everything after the /en/ moved up a level.

            RewriteRule /subdic/en/() /subdic.php/$1?lang=en
            RewriteRule /subdic/de/() /subdic.php/$1?lang=de
            RewriteRule /subdic/dk/() /subdic.php/$1?lang=dk

            I am trying to figure it out, can I make it work with sessions id -
            PHPSESSID and all the rest?

            Best regards
            Cah


            Comment

            • CAH

              #7
              Re: Multi language site with PHP, mysql and cookies - how about search engines?

              On Apr 10, 5:00 pm, Toby A Inkster <usenet200...@t obyinkster.co.u k>
              wrote:
              CAH wrote:
              I need to make at multilanguage language site, and for that I need to
              identify the users, and register there choice off language.
              >
              I urge you to also inspect the user's "Accept-Language" HTTP header to
              determine the default language to show them if they haven't already chosen
              a preferred language.
              >
              This HTTP header is sent by virtually all web browsers and more often than
              not, indicates the user's preferred language.
              >
              --
              Toby A Inkster BSc (Hons) ARCS
              Contact Me ~http://tobyinkster.co.uk/contact
              Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
              >
              * = I'm getting there!
              Hi Toby

              Thanks for the advice.
              Best regards
              Cah

              Comment

              • Erwin Moller

                #8
                Re: Multi language site with PHP, mysql and cookies - how about search engines?

                CAH wrote:
                On Apr 10, 2:16 pm, Erwin Moller
                <since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
                >CAH wrote:
                >With mod_rewrite.
                >>
                >With that you can setup Apache to do this:
                >1) incoming URL:www.site.com/en/page1.php
                >towww.site.c om/page1.php?lang= en
                >>
                >You can set up your own rules (using regular expression).
                >>
                >In that way you do not have to really create all these pages, but they
                >become virtual.
                >You only have to make page1.php pick up the $_GET["lang"] and make
                >decisions for your query based on that.
                >>
                Excellent advice, can Google register that one uses mod_rewrite, or is
                it none the wiser? Can search engines have something agains this
                solution?
                >>
                Best regards
                Cah
                >>
                >Hi,
                >>
                >Searchengine don't know about any url-rewriting taking place.
                >From a searchengine's point of view:
                >1) Ask some URL (www.example.com)
                >2) read all the hyperlinks
                >3) follow a hyperlink, eg:www.example.com/en/page1.php
                >4) Server responds with the HTML.
                >etc
                >>
                >The fact that the server in step 3 using URL rewriting (and actually
                >useswww.exampl e.com/page1.php?lang= en) is completely unknown to the
                >searchbot. It is completely unknown to ANY client. It is just something
                >between you and your friend Apache. ;-)
                >>
                >Regards,
                >Erwin Moller- Hide quoted text -
                >>
                >- Show quoted text -
                >
                Hi Erwin
                >
                It is indeed excellent, I am trying to figure this mod_rewrite out,
                and I have gotten it to work with simple request. But I guess it most
                be possible with just three lines in the htacces file. I would like
                anything in the /en/ directory to just be moved to the above level and
                have the everything after the /en/ moved up a level.
                >
                RewriteRule /subdic/en/() /subdic.php/$1?lang=en
                RewriteRule /subdic/de/() /subdic.php/$1?lang=de
                RewriteRule /subdic/dk/() /subdic.php/$1?lang=dk
                >
                I am trying to figure it out, can I make it work with sessions id -
                PHPSESSID and all the rest?
                Hi,

                RewriteRule /subdic/en/() /subdic.php/$1?lang=en

                What is the () excactly matching?
                I am no REGEX wizard myself, but you can write that better, and in 1 rule.

                I could be wrong, but what about:

                RewriteRule /subdic/(en|de|dk)/(.*)$ /subdic.php/$2?lang=$1

                (en|de|dk) <-- in $1
                (.*)$ <-- The $ matches end-of-line. So $2 will contain the original
                scriptname.

                If you are passing more information in the URL, you need to adjust the
                regexp to catch that too and make a good URL (with ? and &)

                eg:
                incoming URL:


                you want that translated into:


                And:

                should be:


                So you need to add more logic for the ? and &.

                But as I stated before: I am no regexp wizard, so ask somebody else for help
                on them. ;-)

                Good luck.

                Regards,
                Erwin Moller





                >
                Best regards
                Cah

                Comment

                Working...