2017-02-09 1 views
-1

.방법은 https로 웹 사이트를 리디렉션 : HTTPS로 리디렉션하지 // : // www가 나는 고객이 브라우저에 URL 아래에 입력하면 <a href="https://domain.com" rel="nofollow noreferrer">https://domain.com</a></p> <p>에 리디렉션 할 필요가

  1. domain.com
  2. www.domain.com
  3. http://domain.com
  4. http://www.domain.com

내가 CodeIgniter의 프레임 워크를 사용하고 있습니다. .htaccess를 변경하면 어떻게 관리 할 수 ​​있습니까?

나는 당신이 사용할 수있는 htaccess로

코드 아래
<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 

    RewriteBase /demo 

    RewriteCond %{REQUEST_URI} ^system.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    RewriteCond %{REQUEST_URI} ^application.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
+2

주 당신의 .htaccess – Naincy

+1

을 당신은 당신의 htaccess로 함께 할 수 있습니다. –

+5

[htaccess redirect to https : // www]의 가능한 복제본 (http://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www) – drmonkeyninja

답변

0

을 사용하고 있습니다 :

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] 
+0

감사합니다. 작동 중입니다. 알려주세요. 필요합니까? 아래 스크립트를 추가 하시겠습니까? 한다 RewriteCond % {REQUEST_URI}^시스템. * RewriteRule의 (^. *) $ /index.php?/$1 [L] 한다 RewriteCond % {REQUEST_URI}^애플리케이션. * RewriteRule의 (^. *)의 $ /index.php ?/$ 1 [L] 한다 RewriteCond % {REQUEST_FILENAME}! -f 한다 RewriteCond % {REQUEST_FILENAME}는! 한다 RewriteRule이^(. *) $ index.php를?/$ 1 [L] – Manraj

+0

이 그것은 어떻게 사이트 작품에 관련이 -d 서버가 아닙니다. 그러나 나는 그렇게 생각한다. 다른 것들 다음에 추가하십시오. – Croises

+1

이 답변으로 문제가 해결되었으므로 [이 답변의 왼쪽 상단에 ** 체크 표시 **를 클릭하여 대답을 표시해야합니다] (http://meta.stackexchange.com/a/5235/160242) 고맙습니다 ! – Croises

관련 문제