We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20014
    • 200 Posts
    EDIT: this is actually a question about how to get friendly urls to work with containers that have a redirect snippet pointing to the home language pages.

    was looking at how to do a multilingual site and really most of it was unnecessary in my case, except for the redirect snippet suggested:

    <?php
    $url = $modx->makeUrl($id);
    ob_end_clean(); // this will end the output buffer and discard silently what ever was in it
    header('Location: '.$url);
    ?>


    and then paste this in the parent page
    [[Redirect?id=`1`]] (id pointing to the start page of a new language)

    I know the problem is id 1 not being found because friendly urls wants to use the alias, but changing id to alias doesn’t work either, i’ve found a couple threads but dealing with 301 redirects, any suggestions?

    do I use documentIdentifier; instead of $id?
      • 19369
      • 1,098 Posts
      Hi Modxlearner123

      I did few multilanguage websites, here is an example for you

      Structure:

      -en (1)
      -Home (2)
      -News (3)
      -Contact (4)

      Now, set en (1) uncached and redirect it to Home (2), so in the call the id is 2 [[Redirect?id=`2`]]
        • 20014
        • 200 Posts
        I’ve tried everything, first setting the friendly urls without mod_rewrite, it breaks because because the language redirect is a container, also by setting with mod_rewrite setting rewrite base and rewrite rule to point at the subfolder of my root installation (the server is set up with the domain in the subfolder) for example /mysite.com and /mysite.com/en and in the rewrite rule:RewriteRule ^(.*)$ /mysite/index.php?q=$1 [L,QSA]
        and RewriteRule ^(.*)$ /mysite/en/index.php?q=$1 [L,QSA] neither worked, I am on a host which allows mod rewrite...

        the folder "en" is the redirect page to the english version of my site, so essentially, just to clarify, I did it normally as anyone would and also tried by setting htaccess to view en as a folder.

        any thoughts?
          • 20014
          • 200 Posts
          Just to let you know I have already done this for a couple sites, but only this one using the redirect page has problems, so I thoroughly gone through as many threads as I could possibly find.

          the en folder is set at start page in manager and its id is 1

          the site structure has always been (should have been a bit clearer, I apologize for these hit and run questions, I’ll pick up better etiquette with regards of asking....I promise rolleyes)

          id1 en
          a page
          a page
          id80 es
          a page
          a page
            • 20014
            • 200 Posts
            solution found: turn off Use Friendly URL alias path in the manager, friendly urls tab

            since I am fluent in both langauges, the simpler solution for the redirect page rather than the one found here:http://modxcms.com/forums/index.php/topic,29597.20.html was my best bet for this particular site, now everything plays nice...