rewrite http to https and https to http

CentOS5.6

Apache2.2系にて.htaccessを使用してrewrite処理を行う

とあるフォルダ下は「http」から「https」へ

とあるフォルダ下は「https」から「http」へ
(↑これが結構???苦労しました)

あと.htaccessにrewrite処理させたい時にはconfに

<Directory "/hoge/htdocs">
 
AllowOverride FileInfo Options
 
Or
 
AllowOverride All
 
</Diredtory>

が必要

そして.htaccessへ

<IfModule rewrite_module>
 
#http tp https
RewriteEngine on
RewriteBase /hoge/htdocs
 
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/ssldir/.*$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 
#https tp http
#RewriteEngine On #ダメなときはこのコメントを削除して試してみる?
#RewriteBase /hoge/htdocs #ダメなときはこのコメントを削除して試してみる?
 
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(^/ssldir/.*$)
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 
</IfModule>

以上、覚書♪

コメントは受け付けていません。