We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I’ve been given a bit of code to keep links from the home page from being allowed as index.php or /home.html or whatever; with this all such requests get redirected to domain.com/ with a 301 message. Put this in a snippet at the top of the template. It’s supposed to do something about SEO and not having duplicate pages.
    $url = $_SERVER["REQUEST_URI"];
    if (ereg("index.php", $url)){
        header('HTTP/1.1 301 Moved Permanently');
        header('Location: http://domain.com/');
    }
    else if (ereg("/unwanted-alias-here", $url)){
        header('HTTP/1.1 301 Moved Permanently');
        header('Location: http://domai.com/');
    }
    

    It could be tweaked for the "modx way" of using $modx->config[’site_url’], and it might also benefit from a snippet option to give it the unwanted alias. It was felt that a plugin was a bit of overkill when it’s only wanted for the one page.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 18367
      • 834 Posts
      It's supposed to do something about SEO and not having duplicate pages.


      Yes, it’s all about not splitting you’re "link juice" (not my term).

      If you have one lot of traffic going to "your domain" and another going to "home" or "index" then you are halving that page’s seo and ranking performance

      Apparently it’s a very common "mistake" and one of the first things seo consultants fix.
        Content Creator and Copywriter