We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12379
    • 460 Posts
    Yes, I started using Encrypt without the .htaccess stuff by accident but the url rewrites were crazy. At least using the .htaccess they suggest has helped in roping in some of those url names, I think. There’s also sslswitcher by soushi http://modxcms.com/forums/index.php/topic,20661.0.html but no English instructions as yet. I tried your solution but non-ssl pages linked to from ssl pages still came up with https in the address bar.
      Mostly harmless.
      • 18330
      • 20 Posts
      Hi People. i have a problem with the snippet encryption. I need modify this for it work correctly (Sorry by my english, i am argentinian)
      I can modify the snippet and work correctly, but i have a problem with the $_POST variables. i use this on a form, but when i activated the encryption the $_POST variables dissapear. I not an expert in php. If any can help is be good.
      Thanks
        • 12379
        • 460 Posts
        Yes, I think it needs more work before it’s ready for "primetime"... I’m hoping to have English instructions for sslswitcher available soon.
          Mostly harmless.
          • 18330
          • 20 Posts
          Thanks for answer me quickly. i’ll be here for the instructions of sslswitcher smiley i’ll continue make a few proves. if i’ll find the answer i’ll post here.
          See you
            • 29934
            • 11 Posts
            Hello all,
            I’m having a problem with Encryption. It works all right but only once. I have created a button that opens a pop-up window under the secure connection ; when I click it’s OK but then when I reload it won’t work and all I get is the normal connection. All the files are on the same server, I can choose http or https as I like. I’ve tried used the TV or using the template with encrypt all option, but with the same result. Any idea ? Thanks
            T
              • 18330
              • 20 Posts
              Maybe the page is cacheable and this is the problem, can you make a prove? leave out the setting cacheable and prove again
              let me know if it work fine.
              see you and good luck
                • 29934
                • 11 Posts

                It works fine ! I didn’t think about it because I tried emptying the browser cache, and that would not work, so I thought it was another issue.
                Sometimes the problem is in front of you and you just don’t see it !
                Thanks a lot, you made my day ! laugh
                  • 28609
                  • 29 Posts
                  I’m not entirely handy with modx...can someone tell me what I’m doing wrong (or right?)

                  The site has a member login and the client wants all pages after the login to utilize their SSL certificate. I have a member_page template that all of the pages after login uses. I created the
                  snippet and named it encryption. I modified it as the documentation suggests:

                  // CONFIGURATION SECTION ::::::::::::::::::::::::::::::::::::::::

                  // secure location of modx installation - no trailing slash
                  $secureserver = "https://arcpa.org";

                  // unsecure location of modx installation - no trailing slash
                  $unsecureserver = "http://arcpa.org";

                  // END OF CONFIGURATION SECTION ::::::::::::::::::::::::::::::::::::::::



                  // Parameters ::::::::::::::::::::::::::::::::::::::::

                  // alwaysencrypt - set to 1 to always encrypt the page
                  $alwaysencrypt = isset($alwaysencrypt)? $alwaysencrypt: 1;

                  // End of Parameters ::::::::::::::::::::::::::::::::::::::::

                  I put [[Encryption?alwaysencrypt=`1`]] at the very top of the member_page template.

                  https://arcpa.org/677.html is the test login page that I did. The message I get is:
                  Although this page is encrypted, the information you have entered is to be sent over an
                  unencrypted connection and could easily be read by a third party.

                  I think my failure is with the Template Variable.
                  Description:
                  Checks a template variable to see if a page should be encrypted using SSL or not.
                  The template variable must be called "encryption" and if the value of the template
                  variable is "On" for a specific page, then it will be encrypted using SSL.

                  I haven’t used a template variable before and when I went to create it, I was unsure of what to do, so I did this:
                  - Created a template variable named encryption
                  - Input type = text
                  - Default value = 1
                  - Selected the member_page template
                  - Set access permissions to the members group
                  - Saved it

                  Now, you have everything that I’ve done...so hopefully one of you modx old hands can say "what a moron...you need to do X and Y"

                  I really appreciate any help...
                  -
                    • 14491
                    • 15 Posts
                    I’m having some issues with the encryption snippet

                    My setup:
                    Unencrypted page: http://cefabank.com
                    Encrypted page: https://preston.eukhost.com/~cefabank
                    Friendly URLs off (for now, while I figure this out)

                    Here’s what happens:
                    Load page
                    Click to my secure page
                    Page is redirected correctly to ssl
                    Click back to unsecure page
                    Page is redirected incorrectly with ~cefabank/ still in the path

                    For some reason the page still loads without a problem even though the redirected url is
                    http://cefabank.com/~cefabank/index.php?id=53 

                    when it should be
                    http://cefabank.com/index.php?id=53 

                    I suppose this is because of rewrite rules. This would only be a minor annoyance except that when the user goes back to the encrypted page a second time he is redirected to:
                    http://cefabank.com/~cefabank/~cefabank/index.php?id=188

                    Which gives a 404 error

                    A little debugging using echo reveals that on the line
                    $url = $_SERVER['REQUEST_URI'];


                    $url is set to /~cefabank/index.php?id=6

                    So the line

                    $modx->sendRedirect($unsecureserver.$url);


                    is redirecting the page to http://cefabank.com/~cefabank/index.php?id=1. Any ideas? I suppose I could hack the code to remove the ~cefabank from the front of $_SERVER[’REQUEST_URI’] every time but I think there must be a better solution.

                    my .htaccess is
                    RewriteEngine On
                    RewriteBase /
                    RewriteCond %{REQUEST_FILENAME} !-f
                    RewriteCond %{REQUEST_FILENAME} !-d
                    RewriteCond %{SERVER_PORT} 80
                    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
                    RewriteCond %{REQUEST_FILENAME} !-f
                    RewriteCond %{REQUEST_FILENAME} !-d
                    RewriteCond %{SERVER_PORT} 443
                    RewriteRule ^(.*)$ ~cefabank/index.php?q=$1 [L,QSA]

                    my Enctyption config:
                    $secureserver = "https://preston.eukhost.com/~cefabank";
                    $unsecureserver = "http://cefabank.com";



                      • 14491
                      • 15 Posts
                      Ok, here’s my hack to make it work. I modified this code:

                      else if (strtolower($_SERVER['HTTPS']) == "on" && !$encryption) {
                        $modx->sendRedirect($unsecureserver.$url);
                      }


                      To read:

                      else if (strtolower($_SERVER['HTTPS']) == "on" && !$encryption) {
                        #HACK: this cuts the unnecessary foldername off the front of the string
                        $url =  substr($url,strlen("/~cefabank"),strlen($url));
                        $modx->sendRedirect($unsecureserver.$url);
                      }


                      I spelled out /~cefabank instead of putting 10 to make it more obvious what I’m doing. I’ve verified this works for me both with and without friendly urls.

                      I still feel this is very much a hack. My setup doesnt seem to be abnormal so if anyone has any suggestions why it didn’t work out of the box, please let me know!