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

    I'm working on a new site which includes Discuss forums. I've setup Discuss to use SSO so that access is via MODX user accounts. There may be other user account based areas in the future.

    I would like to 'force' the website to served over HTTPS for
    - Register page
    - Activation page
    - Login page and all pages while logged in

    From what I've gleaned off internet so far this will require some .htaccess configuration but I haven't found an example that exactly matches my requirements.

    Can anyone provide an example and/or give some tips?

    Thanks,



    System:
    - MODx: Revo 2.2.14-pl
    - Host: siteground
    - cPanel: 11.42.0
    - Apache: huh ... strangely not visible in cPanel
      • 34926
      • 87 Posts
      To get you started an example for your virtualhost or .htaccess file could be:

      RewriteCond %{HTTPS} off
      RewriteCond %{REQUEST_URI} (register|activation|login)
      RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
      
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I would be inclined to try something clever with weblinks. Have the non-ssl links for a weblink that points to the ssl page.

        While testing this idea, I also found an excellent article on preparing MAMP for handling SSL. Now I can play!
          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
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Hm. While the weblink idea does work, it switches the whole site to ssl. Not quite what we want.

          I'm looking into some plugins. https://forums.modx.com/thread/14025/how-to-make-a-single-page-in-modx-ssl-secure?page=2#dis-post-77126
            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
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            The above-linked forum post with the plugin code from Bert Oost's post is working great on localhost. Pretty easy, I created a radio button TV for SSL/No SSL, set to No SSL by default. Now all I have to do is set a page's TV to SSL and it just pops back and forth.

            TV name: encryption
            Input Type: Radio Options
            Input Option Values: SSL==1||No SSL==0
            Default Value: 0
              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
              • 6057
              • 26 Posts
              Thanks for all the replies. I've got it working with the .htaccess solution suggested by Gibbs.

              I tried the RevoSSL plugin and it worked seamlessly. The only snag with it though was that I couldn't use it to force URLs within the forums 'folder' setup by Discuss. So the rewrite rules would make those URLs https only to be pushed back to http by RevoSSL.

              Thanks for the help.

              PS: How do I mark this thread as Solved?
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                If you flagged it as a question, in the upper right corner of each post will be a star. Click the one that answers your question.
                  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