1

いくつかの選択したページを HTTPS にリダイレクトしようとしています。多数の例を見つけましたが、現在の htaccess ファイルの内容では機能しないようです。私の現在のhtaccessには

RewriteEngine On
Options +FollowSymLinks
# Redirect all other domains to the primary
RewriteCond %{HTTP_HOST} ^(www\.?|)(domain1\.com|domain2\.com|domain3\.com|\.co)$
RewriteRule ^(.*)$ http://www.prefferreddomain.com/$1 [R=301,L]
# Error Documents
ErrorDocument 401 /errors/401.php
ErrorDocument 403 /errors/403.php
ErrorDocument 404 /errors/404.php
#Cache Settings, etc. after this

複数のドメイン名 (20 以上) を所有しているため、現在 SEO 用の htaccess ファイルでこれを行っています。とにかく、3 つのページを HTTPS にリダイレクトしたいのですが、試したすべての例が期待どおりに機能しませんでした。現在htaccessファイルにあるリダイレクトの前または後に配置する必要があるかどうかはわかりません。

https にリダイレクトする必要があるページは、logon.php と chat.php です。だから私は試しました

RewriteEngine On
Options +FollowSymLinks

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (logon.php)
RewriteRule (.*) https://www.preferreddomain.com%{REQUEST_URI} 

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (chats.php)
RewriteRule (.*) https://www.preferreddomain.com%{REQUEST_URI}

# Redirect all other domains to the primary
RewriteCond %{HTTP_HOST} ^(www\.?|)(domain1\.com|domain2\.com|domain3\.com|\.co)$
RewriteRule ^(.*)$ http://www.prefferreddomain.com/$1 [R=301,L]
# Error Documents
ErrorDocument 401 /errors/401.php
ErrorDocument 403 /errors/403.php
ErrorDocument 404 /errors/404.php
#Cache Settings, etc. after this

しかし、これはうまくいきませんでした。誰にも指針がありますか。

4

2 に答える 2

0

[R=301,L]各 https:// ルールの末尾に追加します。がないL場合、ルールは URI にリダイレクトのフラグを立てますが、URI は書き換えエンジンの残りの部分を通過し続け、最後のルールにも一致します。

于 2012-08-24T18:22:54.813 に答える
0

うまくいかなかった理由は、私たちのホスト ネットワーク ソリューションが SSL にプロキシを使用しているため、プロトコルを検出するサーバー側が機能せず、通常はループが発生するためです。

于 2012-08-28T20:18:26.593 に答える