myredirectsを希望どおりに動作させることができません。私の目標は以下のとおりです。http://www.example.com wwwとhttpsリダイレクトが希望どおりに動作しない
https://www.example.comの目標1はaleady達成されているが、問題はhttps://www.example.comへのリダイレクトhttp://www.example.comであり、そのは実際に404に結果
- リダイレクトhttp://example.comリダイレクト
- https://www.example.comにエラー。
方法1.
<If "%{HTTP_HOST} != 'www.enmowe.com'">
Redirect "/" "https://www.%{HTTP_HOST}/$1"
</If>
<If "%{SERVER_PROTOCOL} != 'HTTPS'">
Redirect "/" "https://www.%{HTTP_HOST}/$1"
</If>
方法2:私は私のApacheのVirtualHostで、次の試してみました
https://enmowe.com/ (403) is not reachable
http://enmowe.com/ (301) is forwarding to https://www.enmowe.com/ (200)
https://www.enmowe.com/ (200) is available
http://www.enmowe.com/ (404) is not reachable
:私は以下の通りである問題を識別するためにRyteを使用しました
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www.\.enmowe\.com)?$
RewriteRule (.*) https://www.enmowe.com/$1 [R=301,L,NC]
方法3
RewriteEngine on
RewriteCond %{SERVER_NAME} =enmowe.com
RewriteRule^https://www.%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
ちょっとあなたは、プロトコル、ホスト名か右でない場合はリダイレクトしたい今
Apacheは、www.enmowe.comの仮想ホストエントリを持っていますか?そうでなければ、書き換えルールは起動できません。 –
www.enmowe.comは仮想ホストのServerAliasとして設定されています –