Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2005
    Location
    Latina (Italy)
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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!

  • #2
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    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.

  • #3
    New Coder
    Join Date
    Sep 2005
    Location
    Latina (Italy)
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •