We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20188
    • 4 Posts
    Is there a way to forbid accessing documents using numeric IDs so that they are available thru aliases only? Thanks.

    Using MODx 0.9.6.3
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You could use a plugin. Use the OnWebPageInit event, and check the $modx->documentMethod value; it will be ’id’ or ’alias’. If it’s ’id’ then either redirect or send to the unauthorized or error page ( $modx->sendErrorPage(); )

      I’m sure you could also deal with this in the .htaccess file, although that’s outside of my area of knowledge.
        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
        • 20188
        • 4 Posts
        Thanks so much, your advice is exactly what I was looking for! I would prefer stick to the way .htaccess works by default and work this around via the code.