Force back to HTTP (without S) for certain pages

Hi there,

I will really appreciate if someone could give me an advice on what to do. I have 2 pages of my site forced to HTTPS and of course every link in those two pages refers to HTTPS URLs. I would like to make the user redirects back to HTTP version of one page if the user clicks on page links.

In summary I would like to get a change back to HTTPS for specific pages.

What code should I use in each page?

I really appreciate your help.
Thanks

Hi thank you for the input, I 'm sorry because made a typo error.

I would like to get a change back to HTTP (without S) for specific pages.

I just have this code in my pages toforce HTTPS

<?php

if($_SERVER['HTTPS'] != 'on') {
    header('Location: https://XXXXX/member/sign_in.php');
}

What code should I use in the pages where I want to force the HTTP (without S) ??

Detect your protocol, and redirect to corresponding page. $_SERVER contains information about http or https protocol.
If you don’t find https there, it is http.

die(header('Location: https://domain/file.php'));

or,

die(header('Location: http://domain/file.php'));

Use full url to redirect, and die() to stop executing below the code.

If you use a full url including the http:// then that will be used.

Alternatively you could use the <base href=“”> tag and be explicit when you want to use https://