[pmwiki-users] Getting ssl to work with the http: to https: forcing script?

Patrick R. Michaud pmichaud at pobox.com
Tue Jan 23 15:47:12 CST 2007


On Tue, Jan 23, 2007 at 07:41:49PM +0100, christian.ridderstrom at gmail.com wrote:
> On Mon, 22 Jan 2007, Patrick R. Michaud wrote:
> 
> >Note that PmWiki version 2.2.0-beta18 and later automatically detect 
> >https: and use it accordingly.  So, with 2.2.0 you can do:
> >
> >   if ($UrlScheme != 'https:') {
> >     $ScriptUrl = str_replace($UrlScheme, 'https:', $ScriptUrl);
> >     if (!@$pagename) { header("Location: $ScriptUrl"); exit; }
> >     Redirect($pagename);
> >   }
> 
> Could you explain the purpose of this code?

If someone accesses the site using a non-secure url (i.e.,
$UrlScheme is not 'https:'), then they are automatically 
redirected to the secure version of the requested page.

Pm




More information about the pmwiki-users mailing list