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
<?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 ""; ?>