Difference between revisions of "Enabling HTTPS on your site"

From Joomla! Documentation

m (delete "virtuemart")
Line 16: Line 16:
 
RewriteCond %{HTTPS} on
 
RewriteCond %{HTTPS} on
 
RewriteRule ^(home|help)(.*)/?$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]</pre>
 
RewriteRule ^(home|help)(.*)/?$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]</pre>
 +
 +
If you want to force SSL on a specific folder you can insert the code below into a .htaccess file placed in that specific folder:
 +
 +
Code:
 +
<pre>
 +
RewriteEngine On
 +
RewriteCond %{REQUEST_URI} folder
 +
RewriteRule ^(.*)$ https://www.example.com/folder/$1 [R,L]</pre>
 +
 +
Make sure you change the folder reference to the actual folder name. Then be sure to replace www.example.com/folder with your actual domain name and folder you want to force the SSL on.

Revision as of 01:59, 2 April 2017

Documentation all together tranparent small.png
Under Construction

This article or section is in the process of an expansion or major restructuring. You are welcome to assist in its construction by editing it as well. If this article or section has not been edited in several days, please remove this template.
This article was last edited by Leolam (talk| contribs) 7 years ago. (Purge)

Copyedit.png
This Article Needs Your Help

This article is tagged because it NEEDS REVIEW. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.


For setting up the certificate, the simplest way is to get your host to do it for you. Once you've bought a Dedicated IP and SSL certificate, simply ask your host to help and they will get it signed and install it in the correct location for you. Once it's done, you should be able to manually enter HTTP or HTTPS on any page.

If you're also asking how to automatically switch between HTTP and HTTPS depending on which page you're on, most of the work is done for you if you set your SECUREURL correctly in your configuration (i.e. set to https://yourdomain.com). If you have other pages on your site that you want to be secured (as I do), then you can handle these through your .htaccess. As an example, to switch from HTTP to HTTPS on any page that has 'abc/def' or 'ghi' in the URL, add something like this:

Code:

RewriteCond %{HTTPS} off
RewriteRule ^(abc/def|ghi)(.*)/?$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]


... and to switch from HTTPS back to HTTP on any page that has 'home' or 'help' in the URL, do something like this:

Code:

RewriteCond %{HTTPS} on
RewriteRule ^(home|help)(.*)/?$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]

If you want to force SSL on a specific folder you can insert the code below into a .htaccess file placed in that specific folder:

Code:

RewriteEngine On 
RewriteCond %{REQUEST_URI} folder 
RewriteRule ^(.*)$ https://www.example.com/folder/$1 [R,L]

Make sure you change the folder reference to the actual folder name. Then be sure to replace www.example.com/folder with your actual domain name and folder you want to force the SSL on.