We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28376
    • 222 Posts
    I created the following snippet called redirectpage with the following code below

    <?php
    $rurl=$_REQUEST['url'];
    
    // Redirect the user to a new web site, and tell HTTP agents that the site has moved permanently
    $modx->sendRedirect($rurl, 0, 'REDIRECT_HEADER', 'HTTP/1.1 301 Moved Permanently');
    ?>
    



    This snippet is called like this
    [[redirectpage? &url=`http://www.domain.com/`]]
    



    But the code isn’t working not sure why.

      • 4041
      • 788 Posts
      Try this and see if it makes any difference, also try calling the snippet uncached [! !] :

      <?php
      $rurl= isset($url) ? $url : '';
      
      // Redirect the user to a new web site, and tell HTTP agents that the site has moved permanently
      if($rurl !=''){
          $modx->sendRedirect($rurl, 0, 'REDIRECT_HEADER', 'HTTP/1.1 301 Moved Permanently');
      }
      ?>

        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 28376
        • 222 Posts
        It worked. Thanks for all the help smiley