Page 1 of 1

https to http and relative URL

Posted: Wed Apr 23, 2003 1:43 pm
by RATICIDE
Hello,

I am currently developping a site in which users have to log on using a userid/password. I would like these informations to be sent in a secure way to my web server. So I have configured apache 2.x so that he can respond to https requests.

My problem is that once these informations have been sent to the servers, I would like the user to use http protocol instead of https. But actually, the user does use https all the time. This is due to the fact that I am using relative urls (which is better I believe).

In fact my site does contain sections for which secured access is required and some other for which it is not necessary to encrypt data. I would like to know how I should proceed to force access to section in https and force access to ther section of my site in http.

Can somebody help me ? :?

Regards,

R.

Posted: Wed Apr 23, 2003 4:03 pm
by m3mn0n
Maybe once the secure process is finished, add...

Code: Select all

<?php
header ("Location: http://thesitedomain.com");
?>
Hope it helps...

Posted: Wed Apr 23, 2003 5:47 pm
by Kriek
See [HTTP authentication] with PHP. Of course there are simpler methods, but none more or less secure IMO. Enjoy and feel free to ask any questions you have or any problems you may encounter.

Code: Select all

<?php
    ob_start();
    if (($PHP_AUTH_USER == 'admin') && ($PHP_AUTH_PW == 'password')) {
?>

//page here

<?php
    } else {
        header('WWW-Authenticate: Basic realm="Authorization Required!"');
        header('HTTP/1.0 401 Unauthorized');
        echo 'Authorization Required!';
    }
    ob_end_flush();
?>

Posted: Fri Apr 25, 2003 6:14 am
by RATICIDE
Thx for the infos. I will give them a try. :D

R.