We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    My host has a free shared SSL cert. that I'm trying to use with a single page. As per their docs, this works to access the page as a secure page directly in the browser:

    https://secure.myhost.com/~username/mysite/pagealias.html


    The trouble is that when I use that as the frozen URI for the page, I get this:

    mysite.com/https://secure.myhost.com/~username/mysite/pagealias.html


    The frozen URI is prefixed with the site_url.

    Does anyone know a good way around this?



    [ed. note: BobRay last edited this post 13 years ago.]
      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
      • 38723
      • 165 Posts
      I think the last time I had to set this up, I ended up with some mod_rewrite to just rewrite the page URL in question from HTTP to HTTPS to avoid relying on MODX to get the URL correct!
        • 22303 MODX Staff
        • 10,725 Posts
        There are several approaches, but if it is just a single page, a Snippet that executes first on that Resource which 301 redirects requests where the url_scheme is set as http would also work.
          • 3749
          • 24,544 Posts
          Quote from: opengeek at Oct 01, 2013, 08:35 AM
          There are several approaches, but if it is just a single page, a Snippet that executes first on that Resource which 301 redirects requests where the url_scheme is set as http would also work.

          Thanks. Would I need makeURL() or could I just sendRedirect() to the https address?
            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
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: BobRay at Oct 01, 2013, 12:41 PM
            Quote from: opengeek at Oct 01, 2013, 08:35 AM
            There are several approaches, but if it is just a single page, a Snippet that executes first on that Resource which 301 redirects requests where the url_scheme is set as http would also work.

            Thanks. Would I need makeURL() or could I just sendRedirect() to the https address?

            You wouldn't need it, but you might as well make it portable, e.g.
            if ($modx->getOption('url_scheme') !== 'https://') {
                $modx->sendRedirect(
                    $modx->makeUrl(
                        $modx->resource->get('id'),
                        '',
                        '',
                        'https'
                    ),
                    array(
                        'responseCode' => 'HTTP/1.1 301 Moved Permanently'
                    )
                );
            }
            
              • 3749
              • 24,544 Posts
              Thanks again. I'll give it a shot.
                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