作者style520 (XXYY)
看板FreeBSD
标题[问题] 利用 .htaccess 来达到 ForceSSL
时间Fri Dec 8 22:00:50 2006
在PHP里,可以使用以下方法来达到强制使用SSL连线
<?php
if (!isset($_SERVER["HTTPS"]) || $_SERVER["HTTPS"]!='on')
{
$ssl_url = '
https://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
header("Location: $ssl_url");
exit;
}
在 .htaccess 里,我想到一个方法
Redirect /
https://www.mydomain.com/
但问题在於
Redirect Syntax: Redirect [status] URL-path URL
URL 必须为绝对网址, 若果 Apache 的 ServerName 有改, .htaccess 也要跟着改
有什麽方法达到像PHP那样的功能吗?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 210.60.29.70