We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53118
    • 28 Posts
    Hello Guys,

    I have a website where the users can change the city and the currency

    This will give them the price of the service in the chosen city and the price will be converted in the chosen currency

    The typical URL scheme is http://localhost/language/city/currency/ for example:

    http://localhost/en/Paris/USD/
    http://localhost/de/Amsterdam/EUR/
    http://localhost/fr/London/BGN/
    


    The default city is set to "Paris" and the default currency is set to "EUR", which implies that loading the 3 following URLs will have exactly the same content:

    http://localhost/en/
    http://localhost/en/Paris/
    http://localhost/en/Paris/EUR/
    


    I guess it's not SEO optimal to have duplicate pages

    It's the first time I am confronted to this situation and I have no clue how to remove those duplicates

    Should I use modx->sendRedirect or sendForward?
    Should I add the missing parameters to the URL directly in .htaccess?

    Maybe should I just move the city and currency parameters to session variables or cookies ?

    Thank you for the help laugh [ed. note: radoslav last edited this post 9 years, 9 months ago.]
      • 3749
      • 24,544 Posts
      One solution is to make the alternate URLs Weblinks or Symlinks, but it is kind of wasteful to have so many different resources in the DB when you actually only need one.

      I think I would post the form to itself and have a snippet on that page that produces the results after getting the three $_POST variables. That way the whole project is a single resource and one snippet.

      Another way to go would be to use JavaScript on the page to produce the results without a page reload.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 53118
        • 28 Posts
        Hi BobRay and thanks for the help,

        Excuse me I don't understand your advice, but surely my question was also not clear

        My problem is simply that the start page url is http://localhost/en/ but then the user can choose a city and currency which implies the url will be http://localhost/en/city/currency/

        Tf the city and currency paramters are not set in the url, I programmed a default city and currency (Paris and EUR) that apply to http://localhost/en/, this means that http://localhost/en/ and http://localhost/en/Paris/EUR/ are strictly duplicates

        In other words, how to add url parameters to the start page

        I just would like to have http://localhost/en/Paris/EUR/ as start page (instead of http://localhost/en/ currently)

        Thank you
        Radoslav
          • 3749
          • 24,544 Posts
          Really, the easiest thing is to put a canonical tag in the head section of the template containing the preferred URL. That will avoid any SEO penalty for duplicate content.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 53118
            • 28 Posts
            Thank you BobRay !