利用 .htaccess 來達到 ForceSSL - BBS
By Ursula
at 2006-12-08T22:00
at 2006-12-08T22:00
Table of Contents
在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那樣的功能嗎?
--
Tags:
BBS
All Comments
Related Posts
Tomcat5.5
By Suhail Hany
at 2006-12-07T18:37
at 2006-12-07T18:37
Re: 請問將BSD安裝在IBM X206M上
By Mason
at 2006-12-06T15:43
at 2006-12-06T15:43
安裝KDE大家都花多久時間??
By Donna
at 2006-12-06T00:49
at 2006-12-06T00:49
安裝KDE大家都花多久時間??
By Adele
at 2006-12-05T22:47
at 2006-12-05T22:47
FreeBSD 6.1安裝的問題
By Hedda
at 2006-12-04T01:27
at 2006-12-04T01:27