View Full Version : Low-level automatic change in addresses (from "http://.." to "https://..") in php.ini

11-02-2007, 03:37 PM
Hi all!
I'd like to know if there is a php.ini directive that can do what I'm going to describe.

Suppose I have an automatic engine (that I cannot modify, because it's a CMS' engine!) that creates hot-references for links such as anchors.
I want to turn them from "http://..." to "https://", but I have to make this only by operating at low-level (so manipulating, maybe, the php.ini file).

I'm pointing at php.ini because I've seen what can it do with url_rewriter.tags (very powerful!!) for inserting the session_id as a GET variable automatically!

Am I on the right way? Is there any kind of directive that can help me?

Thanks in advance!

11-02-2007, 05:00 PM
This can be a difficult issue, to which there is no easy 1-liner that I know of.

In one of the site's engines that I wrote, I would load the page from the database, check for the secure flag and compare it to what the request was in (http / https). If it was secure, but in http, I would forward the user to the https version. And the other way around.

This means I don't have to bother generating proper links for each page, while still maintaining the proper secure/nonsecure divide.

The only downside to this is you cannot do a POST from a secure to nonsecure, or vice versa.

11-03-2007, 11:23 PM
Thanks aedrin for your post.

Although I knew it's not easy, my problem is even harder: I have no access into the core of that CMS I have to use, then I cannot act directly on the pages' database (neither I know if there is any mechanism that separates protected pages from other non-protected, in that platform... and I suppose not!).

The point is: I see there's no way to alter hrefs automatically, using php.ini directives...

Thank you, anyway!