Encryption
Encryption 1.0.2
- 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
This snippet allows you to specify which pages on your site are encrypted. It supports both shared and dedicated SSL certificates and friendly URLs.
Installation
1. Copy the text file into a new snippet called "Encryption".
2. Edit the $secureserver parameter to match the location of your site when it is encrypted. For example https://www.hostingco.com/~foo.
3. Edit the $unsecureserver parameter to match the location of your site when it is not encrypted. For example http://www.foo.com.
Using a Template Variable
1. Create a template variable called "encryption" that is a checkbox. The "input option values" should be "On" (capital O) or 1. The default value should be "Off" or 0.
2. Add the template variable to templates.
3. At the top of each template add the call to the snippet. For example:
4. Edit the documents to be encrypted and check the encryption checkbox.
Using a template
1. At the top of the template add the call to the snippet, setting the alwaysencrypt parameter. For example:
5. Change documents to be encrypted to use this template.
Friendly URLs
1. First test your site without using friendly URLs. If you have a problem then adding friendly URLs will not fix it.
2. Change your .htaccess file to look something like:
The line below %{SERVER_PORT} 80 must match be suitable for the URL for non encrypted access. The line below %{SERVER_PORT} 443 must be suitable for the URL for encrypted access.
That should be it!
Description
This snippet allows you to specify which pages on your site are encrypted. It supports both shared and dedicated SSL certificates and friendly URLs. There are two ways to use it:- Turn encryption on based on a template variable
- Turn encryption on for a template (i.e. all documents using the template will be encrypted)
Instructions
First make sure you can access your site via http and https. For shared SSLs the URL would be something like https://www.hostingco.com/~foo.Installation
1. Copy the text file into a new snippet called "Encryption".
2. Edit the $secureserver parameter to match the location of your site when it is encrypted. For example https://www.hostingco.com/~foo.
3. Edit the $unsecureserver parameter to match the location of your site when it is not encrypted. For example http://www.foo.com.
Using a Template Variable
1. Create a template variable called "encryption" that is a checkbox. The "input option values" should be "On" (capital O) or 1. The default value should be "Off" or 0.
2. Add the template variable to templates.
3. At the top of each template add the call to the snippet. For example:
[[Encryption]]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4. Edit the documents to be encrypted and check the encryption checkbox.
Using a template
1. At the top of the template add the call to the snippet, setting the alwaysencrypt parameter. For example:
[[Encryption?alwaysencrypt=`1`]]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5. Change documents to be encrypted to use this template.
Friendly URLs
1. First test your site without using friendly URLs. If you have a problem then adding friendly URLs will not fix it.
2. Change your .htaccess file to look something like:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ ~foo/index.php?q=$1 [L,QSA]
The line below %{SERVER_PORT} 80 must match be suitable for the URL for non encrypted access. The line below %{SERVER_PORT} 443 must be suitable for the URL for encrypted access.
That should be it!
Previous Releases
Extras
No results found.