2014-01-12 11 views
2

어떻게하면 모든 페이지에 https를 올릴 수 있지만 .htaccess를 통해 frontpage를 켜지 않을지라도 누구나 rewritecond로 나를 도울 수 있습니다..htaccess RewriteCond exclude frontpage

RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR] 
    RewriteCond %{HTTPS} !=on 
    RewriteRule ^(.*)$ https://www.mydomain.com/$1 [R=302,L] 


    # Rewrite URLs of the form 'x' to the form 'index.php?q=x'. 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_URI} !=/favicon.ico 
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 

가 이미이 있고, 내 목표는 HTTPS에 대한 FrontPage를 제외하는 것입니다 만/내부 하위 페이지가 HTTPS를 가져야한다.

제발 내 기존 수정하십시오. 고맙습니다.

답변

0

이러한 규칙을 사용할 수 있습니다

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

RewriteCond %{HTTPS} on 
RewriteRule ^$ http://www.mydomain.com/ [R=301,L] 

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'. 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !=/favicon.ico 
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 

.+ 대신 .* 확실 HTTP는 앞 페이지를 제외한 다른 서브 페이지에 적용됩니다하게

.

+0

고맙습니다. 누군가 https://mydomain.com 또는 https://www.mydomain.com에 액세스하면 다른 사람이 https : // it로 FrontPage에 액세스하는 경우 http : //로 변경됩니다. http : // 전용 frontpage에 강제 적용됩니다. 나머지는 https : // – axscode

+0

예가 될 수 있습니다. 업데이트 된 답변에 해당 규칙을 추가했습니다. – anubhava

+0

대단히 감사합니다. 완벽하게 작동합니다. – axscode

관련 문제