<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "強制將http導到https"]]></title>
		<link>https://www.andowson.com/posts/list/20.page</link>
		<description><![CDATA[Latest messages posted in the topic "強制將http導到https"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>強制將http導到https</title>
				<description><![CDATA[ 最近公司資安議題發燒，為了加強安全性，我們決定將整個網站都透過https傳輸方式讓使用者使用，而要達成這個自動強制將http導到https只要透過Apache的[url=http://httpd.apache.org/docs/current/mod/mod_rewrite.html]mod_rewrite[/url]機制，很輕鬆就可以達成，如下，在/etc/httpd/conf/httpd.conf內加入如下設定即可: 
<br>
<br>
[code]RewriteEngine On 
<br>
RewriteCond %{HTTPS} off 
<br>
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}[/code] 
<br>
<br>
然後重啟Apache 
<br>
[code]/etc/init.d/httpd restart[/code] 
<br>
<br>
[注意]如果您是看畫面自己打字輸入的人，要特別小心(這個小細節花了我好多時間才注意到): 
<br>
1.%{HTTP_HOST}和%{REQUEST_URI}中間沒有斜線('/') 
<br>
2.%{HTTP_HOST}和%{REQUEST_URI}是%開頭，不是$開頭 
<br>
<br>
參考資料: 
<br>
http://www.cyberciti.biz/tips/howto-apache-force-https-secure-connections.html 
<br>
<br>
相關文章: 
<br>
http://www.andowson.com/posts/list/315.page]]></description>
				<guid isPermaLink="true">https://www.andowson.com/posts/preList/474/983.page</guid>
				<link>https://www.andowson.com/posts/preList/474/983.page</link>
				<pubDate><![CDATA[Mon, 28 Mar 2011 18:52:08]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
	</channel>
</rss>