Setting up a larger Joomla site I came in need of running some of the pages with SSL. Neither Joomla’s forum nor Google seems to have a satisfactory solution for this topic. Fortunately I came up with a solution using the indispensable plugin Jumi.

Jumi lets you include custom code – PHP, HTML, CSS, JavaScript – into any of Joomla’s articles or modules.

1. If you haven’t already installed it, install Jumi now.

2. Create a PHP file containing the following code:

<?php
defined('_JEXEC') OR die("Direct Access Is Not Allowed");

$port = $_SERVER['SERVER_PORT'];
$ssl_port = 443;

if ($port != $ssl_port) {
	$host = $_SERVER['HTTP_HOST'];
	$uri = $_SERVER['REQUEST_URI'];
	header("Location: https://$host$uri");
}
?>

3. I named the file redirecthttps.php and uploaded it to my webserver using FTP.

4. In the article, choose HTML view.

5. Add the following code in the begining of the article of a page you want to run with SSL (pathto is the path to the directory where you saved your Jumi file):

{jumi [pathto/redirecthttps.php]}

Posted Monday, April 6th, 2009 at 2:38 pm
Filed Under Category: Coding, Joomla, PHP
You can leave a response, or trackback from your own site.

0

Leave a Reply