2016-11-26 2 views
1

재 작성에 관한 많은 기사를 보았지만 문제가 있습니다.SSL을 사용하여 www가 아닌 ​​www로 리디렉션

example.com = "HTTPS : // example.com (OK)
www.example.com ="HTTPS : // example.com (OK)
HTTPS : // example.com => HTTPS : // example.com (OK)
https : // www.example.com => https : // example.com (FAIL)

그는 여러 가지 포럼 솔루션을 시도했지만 동일한 문제가 있습니다. 이제 내 htaccess로는 다음과 같습니다

<IfModule mod_rewrite.c> 
RewriteEngine On 

RewriteCond %{HTTPS} off [OR] 
RewriteCond %{HTTP_HOST} ^www\.([^.]+\.[^.]+)$ [NC] 
RewriteRule^https://%1%{REQUEST_URI} [L,R=301,NE] 
</IfModule> 

답변

0

당신은 사용할 수 있습니다

코드에서
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC] 
RewriteRule^https://%1%{REQUEST_URI} [NE,L,R=301] 
RewriteCond %{HTTPS} off 
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301] 
</IfModule> 

가, 두 번째 테스트는 http로 수행되지, 그리고 % 1이 (가) 정확하지 않습니다.

관련 문제