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

    I am redirecting a few different admin tools back to a modx site/page for unauthorized access.
    The redirect has the modx page id and a URL variable in the URL.

    On the modx page it has the an "Unauthorized Access" and then has a PHP snippet.
    the snippet says "Requested URL: [URL]".

    It works fine, but its caching the URL.... so if you go to the other system and get redirected back to the modx main site then the URL could be wrong.

    Is there a way to turn off the cache? is there a better way of doing this ?


    here is my php snippet code:
    
    <?php
    $site_text = "";
    
    $site_text .= "Requested URL:   ";
    $site_text .= "$_GET[URL]";
        
    $site_text .= "<BR><BR><BR>You have been redirected to domain.com";
    
    return $site_text;
    
    

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      Are you calling the snippet uncached?

      [[!SnippetName]]
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 54497
        • 15 Posts
        Not with !

        I'm using [[Unauthorized-Site-URL]]
          • 54497
          • 15 Posts
          THE ! Bang Works !!!!!

          Thanks....
            • 3749
            • 24,544 Posts
            Glad I could help.

            When a snippet is called without the !, MODX caches the snippet's return value and serves it up every time the snippet is called until the MODX cache is cleared. That goes for all other MODX tags as well, so you only want to call things uncached (without the !) when what they return won't change often or the changes will be made in the Manager, which clears the cache when you save things.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting