나는 완벽한 301 리디렉션을 찾고 있습니다. 그러나 나는 많은 솔루션을 찾고 있으며 어떤 솔루션이 가장 적합한 지 알지 못합니다. 비록 내가 시도하고 그들이 일하고있는 상위 2 옵션. 301 리디렉션 HTTP에서 HTTPS로 : 가장 좋은 방법
이
내가 누군가가이 일에 나를 도와 주면 좋을 것 http://www.exampledomain.com에서 https://www.exampledomain.com에 모든 리디렉션하려는 완전히 새로운 사이트입니다. 나는 많은 참조를 발견하고
, 다음과 같이
1. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.exampledomain.com/$1 [R,L] </IfModule>
2. RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
3. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule^https://%1%{REQUEST_URI} [R=301,L] </IfModule>
4. RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
5. RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
6. RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} example\.com$ [NC] RewriteRule^https://example.com%{REQUEST_URI} [R=301,L,NE]
감사 톤, 제이
해당 규칙은 모두 동일한 작업을 수행하지 않으며 일부는 하위 도메인에서도 작동하고 다른 일부는 작동하지 않습니다. 일부는 포트를 사용하고 다른 포트는 HTTPS 환경 변수를 사용합니다. 일부는 URL에 따라 다른 대상으로 리디렉션됩니다. 또한 SSL을 처리하는 역방향 프록시를 사용하고 있고 규칙이있는 백엔드에 일반 HTTP를 회신하는 경우 (예 : 리디렉션을 설정하지 않은 경우 CloudFlare처럼) 사용자가 원하는대로 할 수 없습니다. . – janh