We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40088
    • 708 Posts
    I developed a PHP/MySQL app for collecting (front-end) and administering (back-end) form submissions using a simple framework. It's a self-contained app separate from the rest of the site, i.e., it's not under MODX control. Currently I link to the app front-end from MODX resources and it works fine. But now that the site is under MODX (and the app is not) the minor hiccup is with the admin side of the app which is password-protected via cPanel (Apache server), so when I try to login to the admin area so instead of getting the server login form I'm redirected to the site homepage (a 404).

    Is there a simple way around this or do I have to bring the entire app into MODX? And if I do import it will it Just Work or will I have to modify it to work within MODX by creating Snippets etc.?

    I suppose the other option would be to look for a MODX Add-on that performs this same function which might be the path of least resistance.

    Thanks
      Todd
      • 3749
      • 24,544 Posts
      If the App has PHP code mixed with HTML (as most do), all the PHP code would have to be moved into a snippet or snippets. How much work that is depends on how modular the code is. On the plus side, you should be much more secure without having the .php files on your site.


      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        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
        • 40088
        • 708 Posts
        Quote from: BobRay at Aug 19, 2012, 07:49 PM
        If the App has PHP code mixed with HTML (as most do), all the PHP code would have to be moved into a snippet or snippets. How much work that is depends on how modular the code is. On the plus side, you should be much more secure without having the .php files on your site.[/url]

        That's pretty much what I was expecting to hear.

        Then let's say I don't bring the app into MODX and I keep things as they have been, why then, when attempting to sign in to the admin backend via the password-protected (in cPanel) area does MODX throw a 404 and redirect me to the site homepage? More to the point, is there a way to stop this from happening. I just want to be able to sign-in like I used to do prior to MODX.

        Revo 2.2.4
          Todd
          • 3749
          • 24,544 Posts
          MODX routes everything through its index.php file, and it doesn't recognize the URL so it sends you to whatever is set as the error_page.

          I'm not really an expert on request handling, but you might be able to create a resource in MODX with an alias that gives the same URL as your page, then put a snippet on page that forwards users to the full URL.

          You might also be able to create a rewrite rule in .htaccess that forwards to the page before MODX gets the URL.


          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            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
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            You can set a rewrite condition to ignore a request for your file in the .htaccess file.
              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
              • 22303 MODX Staff
              • 10,725 Posts
                • 40088
                • 708 Posts
                Quote from: opengeek at Aug 20, 2012, 07:28 AM
                See https://forums.modx.com/thread/9543/solved-problem-with-furls-and-actual-subdirectories-with-htaccess-passwords#dis-post-55421

                Nice. Thank you. That saved me a lot of work.
                  Todd
                  • 40088
                  • 708 Posts
                  It seems I spoke too soon. Using the previous suggestion I'm able to login and access the admin area of the non-MODX app but it now throws a 500 error when accessing the MODX controlled parts of the site. Oh well. This will require more time to figure out which I don't have at the moment but it's a start.

                  Thanks to all.

                  Revo 2.2.4
                    Todd
                    • 22303 MODX Staff
                    • 10,725 Posts
                    This may be because of the connectors/ directory as well, since the manager uses the connectors for all the AJAX requests.