We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25663 MODX Staff
    • 12,272 Posts
    @ApoXX

    Thanks for the .htaccess pointers. I’m adding a few commented out directives in the next release to make this easier for folks in the future. The template file now looks like (part I changed, anyway):
    # Make sure RewriteBase points to the directory where you installed MODx.
    # E.g., "/modx" if your installation is in a "modx" subdirectory.
    #
    # You may choose to make your URLs non-case-sensitive by adding a NC directive
    # to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
    
    RewriteEngine On
    RewriteBase /
    
    
    
    # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
    #RewriteCond %{HTTP_HOST} .
    #RewriteCond %{HTTP_HOST} !^example-domain-please-change\.com [NC]
    #RewriteRule (.*) http://example-domain-please-change.com/$1 [R=301,L]
    #
    # or for the opposite domain.com -> www.domain.com use the following
    # DO NOT USE BOTH
    #
    #RewriteCond %{HTTP_HOST} .
    #RewriteCond %{HTTP_HOST} !^www\.example-domain-please-change\.com [NC]
    #RewriteRule (.*) http://www.example-domain-please-change.com/$1 [R=301,L]
    
    
    
    # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent 
    # https://www.domain.com when your cert only allows https://secure.domain.com
    #RewriteCond %{SERVER_PORT} !^443
    #RewriteRule (.*) https://example-domain-please-change.com.com/$1 [R=301,L]
    
    
    
    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


    See any errors that should be fixed?
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 1932
      • 137 Posts
      Hmmm, actually, the following will redirect from non-https to https:

      RewriteCond %{SERVER_PORT} !^443
      RewriteRule (.*) https://example-domain-please-change.com/$1 [R=301,L]
      


      while the lines below would force the use of a particular domain when a user requests a secure (https) portion of the site:

      RewriteCond %{HTTP_HOST} .
      RewriteCond %{SERVER_PORT} 443
      RewriteCond %{HTTP_HOST} !^example-domain-please-change\.com [NC]
      RewriteRule (.*) https://example-domain-please-change.com/$1 [R=301,L]
      


      I can plug these into one of my servers later and make sure they all work.
        • 25663 MODX Staff
        • 12,272 Posts
        That’d be great to verify ... I’d like to update that and not have question due to unexpected behaviors. tongue
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 23491 ☆ A M B ☆
          • 1,056 Posts
          Regarding force-HTTPS, it is possible for someone to hit https://www.domain.com:80/ which doesn’t make sense, I know... I’ve seen people debate back and forth the best methods, and I’m not sure I’m personally convinced one way or another, so I’ll share mine for fun:

          	# Force HTTPS
          	RewriteCond %{SERVER_PROTOCOL} !HTTPS
          	RewriteCond %{SERVER_PORT} 80
          	RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R=301,L,QSA]
          


          Note: The 301redirect in R=301is optional
            Mike Reid - www.pixelchutes.com
            MODx Ambassador / Contributor
            [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
            ________________________________
            Where every pixel matters.
            • 1932
            • 137 Posts
            I have started using the configuration line, per rthrash’s suggestion. cool Just so everyone knows, the Plugin configuration field is located in the plugin’s configuration tab. Once the configuration line is added, the new options will appear in an html form below the configuration line itself.

            See the repository entry: http://modxcms.com/SEO-Strict-URLs-1335.html

            I’m not yet sure whether to bring in the code created for Geo88 as an option, make it the default behavior, or leave it as a modification. Any thoughts on how to best do this and/or what to call the setting?
              • 23491 ☆ A M B ☆
              • 1,056 Posts
              Works great here!!!
                Mike Reid - www.pixelchutes.com
                MODx Ambassador / Contributor
                [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                ________________________________
                Where every pixel matters.
                • 25663 MODX Staff
                • 12,272 Posts
                So what do you suggest including as the force-https example for the ht.access template file?
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 27376
                  • 576 Posts
                  Just upgraded from a personally modifed version of 0.7.2 to 0.8.2 and it works great! My version didn’t work with alias paths so I turned it off, but now I can turn it on again and it works!

                  Thanks a bunch!
                    • 23491 ☆ A M B ☆
                    • 1,056 Posts
                    FYI, Apoxx assisted me with a new version possibly (0.8.3 ?) that has been working great with both empty/full containers, child containers, etc, etc... more to come shortly...
                      Mike Reid - www.pixelchutes.com
                      MODx Ambassador / Contributor
                      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                      ________________________________
                      Where every pixel matters.
                      • 25663 MODX Staff
                      • 12,272 Posts
                      How about 1.0 and the Resource Repository?
                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me