从安全https重定向到仅一页的http

sot*_*os9 3 php https redirect http apache2

我有一个页面,如果访问它page.php我需要被重定向到http,https否则我的谷歌广告将不会显示.

确切地说,我希望发生以下情况:

https://site.com/page.php?blah=foo?bar=blah - > http://site.com/page.php?blah=foo?bar=blah

我到目前为止尝试过:

RewriteCond %{HTTP_HOST} on

RewriteRule ^page\.php$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

但这不起作用.有什么建议?

Maz*_*aka 17

这也可能是一个快速复制粘贴

if ($_SERVER['HTTPS'] == "on") {
    $url = "http://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    header("Location: $url");
    exit;
} 
Run Code Online (Sandbox Code Playgroud)