We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30382
    • 100 Posts
    Deer all,

    I’m using the multi lingual solution from wiki
    http://wiki.modxcms.com/index.php/Make_Multi_Lingual_Site

    But i encounter 2 problems..

    first one is the redirecting.
    I created a snippet with the code from wiki
    <?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);
    ?>
    


    In my index page i use an empty page with only the redirect snippet call in the document content:
    [[Redirect?id=`6`]]

    But the problem is that the redirecting doesn’t work... sometimes when i press F5 after a while it suddenly does redirect.. I really dont get it.
      • 22303 MODX Staff
      • 10,725 Posts
      First, the wiki is a user-contributed resource, so don’t believe in all the code you see there. Second, use the $modx->sendRedirect() function rather than doing header() redirects and manually closing output buffers. You can find information on this in the API docs, but basically $modx->sendRedirect($modx->makeUrl($id)) will do the job.
        • 30382
        • 100 Posts
        Thanks mate.. Your solutions worked perfect for me.
        Next time i will look for a API based solution before using custom php.