安全なページをサイトに追加しようとしています。サイト内のリンクはすべて現在のプロトコルを使用します (つまり、プロトコルに依存せず、パスは で始まります//
)。
https を使用するためのパス/info/season-tickets/*
と/ticketcontroller/*
、http を使用する他のすべてのパスが必要です。
次のことを行うルールを作成してみました (今のところ、チケットコントローラーの部分は無視します)。
If Port==80 and Path==/info/season-tickets/, rewrite with https
If Port==443 and Path!=/info/season-tickets/, rewrite with http
ただし、にアクセス/info/season-tickets/
すると、https バージョンにリダイレクトするのではなく、example.com/index.php/info/season-tickets
.htaccess は以下にあります - 私の試みは以下# Force https on certain pages
と# Force http everywhere else
、そして他のビットは Kohana フレームワークからのものです
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Force https on certain pages
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} ^/info/season-tickets/?
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
# Force http everywhere else
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} !^/info/season-tickets/?
RewriteRule ^(.*)$ http://www.example.com/$1 [R,L]
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
ルールを並べ替えて、それが修正されるかどうかを確認しようとしましたが、修正されませんでした。
これが機能しない理由 (http://htaccess.madewithlove.be/
機能するはずであることを示しています)...
ありがとう!