https to http and relative URL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
RATICIDE
Forum Newbie
Posts: 2
Joined: Wed Apr 23, 2003 1:43 pm

https to http and relative URL

Post 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.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Maybe once the secure process is finished, add...

Code: Select all

<?php
header ("Location: http://thesitedomain.com");
?>
Hope it helps...
User avatar
Kriek
Forum Contributor
Posts: 238
Joined: Wed May 29, 2002 3:46 am
Location: Florida
Contact:

Post 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();
?>
RATICIDE
Forum Newbie
Posts: 2
Joined: Wed Apr 23, 2003 1:43 pm

Post by RATICIDE »

Thx for the infos. I will give them a try. :D

R.
Post Reply