嗨,我有一个 php 应用程序,我希望 account.php 页面是安全的,但是在将其添加到页面后
$use_sts = true;
// iis sets HTTPS to 'off' for non-SSL requests
if ($use_sts && isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
header('Strict-Transport-Security: max-age=31536000');
} elseif ($use_sts) {
header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], true, 301);
// we are in cleartext at the moment, prevent further execution and output
die();
}
但是,当我浏览页面时,它被设置为 HTTPS,但是当我查看源代码时,内容到处都是,它使用 http 显示文件请求:
<script type="text/javascript" src="http://****/assets/jquery.js"></script>
<script type="text/javascript" src="http://****/assets/jquery-ui.js"></script>
<script type="text/javascript" src="http://****/assets/tables.js"></script>
<script type="text/javascript" src="http://****/assets/global.js"></script>
<script type="text/javascript" src="http://****/assets/cycle.js"></script>
有没有办法将特定页面设置为使用 SSL
我也用 .htaccess 尝试过,但得到了相同的结果
# force https for
RewriteCond %{HTTPS} =off
RewriteRule ^(index|login)\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
谢谢
米