Блокировка SSL не отображается в адресной строке браузера, если URL-адрес содержит .php [closed]

Я установил сертификат SSL на свой компьютер.И принудительно перенаправить его в местоположение "https". Он также работает при перенаправлении в папку, содержащую .html ext. Но total не удалось перенаправить в папку, содержащую .php ext.

В кодировании мое изменение было -

$ssl_cer = TRUE;

if ($ssl_cer && isset($_SERVER['HTTPS'])) {
   header('Strict-Transport-Security: max-age=500');
} 
elseif ($ssl_cer && !isset($_SERVER['HTTPS']) )
{
    header("HTTP/1.1 301 Moved Permanently");

    header("Location: https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);

    exit();
 }

После выполнения этого изменения в моем коде; если вы пытаетесь использовать http, он перенаправляется на https, а также показывает блокировку на некоторых страницах. Но мне интересно, ЕСЛИ ssl включен, тогда он должен получить значение этого сервера $ _SERVER ['HTTPS'] как "On" , Actulay, я не получаю это значение в моих скриптах.

Скоро потребуется помощь, чтобы разобраться с этой проблемой. Я прав в своем описании?

-1
задан 8 February 2013 в 09:42
1 ответ

You have multiple problems here and by using a browser you are testing them all at once and only getting a single result at the end: fail.

Try using curl to test just one of your problems at a time. Starting with the redirect:

It's not unusual in a browser to see a redirect come back, the new request made and another redirect come back from that, yet another new request made and finally a page come back but it all happens so fast that you can't see it happen by watching the URL bar. Browsers can also cache both 302 and 301 responses which can confuse the issue even further. Use curl when testing, it's unambiguous.

curl -I http://example.com/foo.html

curl -I http://example.com/foo.php

Look to see what the HTTP response code is and the value of the Location: header. If these match what you expect, move on to the next problem.

After this, you can test the SSL of the page:

curl -I https://example.com/foo.php

The next step is probably easiest when done in a browser and that is (as @DavidSchwartz said) to check all the resources (images, stylesheets, javascripts, etc.) that the page loads. You need to check that all of the URLs start with https:// and that all of the SSL certificates of all the loaded resources are valid.

The Chrome developer tools or the Firebug addon for Firefox will be the best tools here.

If it's still eluding you, posting the actual URL here can help as bugs become easier to find when you have more people looking at them.

0
ответ дан 5 December 2019 в 20:47

Теги

Похожие вопросы