We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42146
    • 73 Posts
    Most everyone wants the opposite of what i need. Site is full ssl, but one page uses a embedded chat app from a different site that will not work if https. How do i make this one page http?


    I have tried many different options with the .htaccess nothing seemed to work correctly. I just plain dont understand all the rules...

    Here is my current .htaccess chat page is still served as HTTPS

    have xxxxx'ed out domain name for security reasons.

    
     
    
    RewriteEngine On
    RewriteBase /
    
    
    #For Chat to work
    
    # This checks to make sure the connection is not already HTTPS, and not chat.html
    RewriteCond %{HTTPS} !=on
    RewriteCond %{REQUEST_URI} !=/chat.html
    RewriteCond %{QUERY_STRING} !=chat.html
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    
    # Redirect from xxxxxxxxxxxx.com to www.xxxxxxxxxxxx.com
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\.xxxxxxxxxxxx\.com [NC]
    RewriteRule (.*) https://www.xxxxxxxxxxxx.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://www.xxxxxxxxxxxx.com/$1 [R=301,L]
    
    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    
     
     
    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>
    
    <Files config.core.php>
    order allow,deny
    deny from all
    </Files>
    
    <Files ht.access>
    order allow,deny
    deny from all
    </Files>
    
    deny from 96.47.224.42
    
    



    one of my last things to get working on this site. thanks for any help or idea's [ed. note: jstump last edited this post 12 years, 5 months ago.]
      • 20413
      • 2,877 Posts
      See this:
      https://sites.google.com/site/onlyvalidation/page/301-redirect-https-to-http-on-apache-server

      If you get tired of htaccess:
      Here is an EVO snippet that I have used and should
      be simple to re-write for REVO.

      <?php
      /*
      
      ::::::::::::::::::::::::::::::::::::::::
      
       Snippet name: Encryption
       Short Desc: Encrypts a page if needed using SSL
       Version: 1.0.2
       Author: Andrew Ayre ([email protected])
       Updates: ncrossland
       Parameter Passing Addition: Kishore Chintoju ([email protected])
       License: LGPL
      
      ::::::::::::::::::::::::::::::::::::::::
      
      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.
        **Before using configure the values $secureserver and $unsecureserver below.**
      ::::::::::::::::::::::::::::::::::::::::
      
      Changelog:
      v 1.0.2 - ncrossland
      - change method of finding the path to accommodate query strings
      - template variable value can be any boolean (rather than specific strings On/Off) for consistency with other snippets and parameters
      
      ::::::::::::::::::::::::::::::::::::::::
      Example Usage:
      
        Place the call to the snippet at the very top of any template used for encrypted
        pages:
      
          [[Encryption]]
      
          [[Encryption?alwaysencrypt=`1`]]
      
      ::::::::::::::::::::::::::::::::::::::::
      
      */
      
      
      
      // CONFIGURATION SECTION ::::::::::::::::::::::::::::::::::::::::
      
      // secure location of modx installation - no trailing slash
      $secureserver = "https://my.ssl/~url";
      
      // unsecure location of modx installation - no trailing slash
      $unsecureserver = "http://my.regular.url";
      
      // END OF CONFIGURATION SECTION ::::::::::::::::::::::::::::::::::::::::
      
      
      
      // Parameters  ::::::::::::::::::::::::::::::::::::::::
      
      // alwaysencrypt - set to 1 to always encrypt the page
      $alwaysencrypt = isset($alwaysencrypt)? $alwaysencrypt: 0;
      
      // End of Parameters  ::::::::::::::::::::::::::::::::::::::::
      
      
      
      // get encryption setting of current document 
      $tv = $modx->getTemplateVar('encryption', "", $modx->documentIdentifer);
      $encryption = $tv['value'];
      
      // If legacy Off value have been supplied
      $encryption = ($encryption=='Off')?false:$encryption;
      
      // If we're always encrypting
      $encryption = ($alwaysencrypt)?true:$encryption;
      
      // What's the URI of the page we're checking
      $url = $_SERVER['REQUEST_URI'];
      
      // if SSL off and we are about to access a secure page then redirect
      if(strtolower($_SERVER['HTTPS']) != "on" && $encryption) {
        $modx->sendRedirect($secureserver.$url);
      }
      
      // if SSL is on and we are about to acccess an unsecure page then redirect
      else if (strtolower($_SERVER['HTTPS']) == "on" && !$encryption) {
        $modx->sendRedirect($unsecureserver.$url);
      }
      
      return "";
      ?>
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower