질문Q #3348
https에서 index.php 없애는 방법
마카바2015-10-28 17:48:51
index.php를 없애고 싶습니다
게시글을 보고 따라했더니 
http에서는 잘 작동했는데 https에서는 이렇게 하면 될 것 같았는데 안되네요 
어떤게 잘못된건지 봐주실 수 있나요?
컨트롤러에서 인식을 못하는 것 같기도 합니다


<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{HTTPS} off
  RewriteCond $1 !^(index\.php|images|captcha|data|include|uploads|robots\.txt)
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ https://%{HTTP_HOST}/index.php/$1 [L]
</IfModule>

이렇게 적용하고 
example.com으로 접속하면 
이렇게 뜹니다
https://example.com/index.php/index.html


답변6
#1 한대승(불의회상) 2015-10-28 18:08:26
아래 설정으로 테스트 해보세요.
RewriteEngine On

RewriteCond $1 !^(index\.php)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L]
#2 마카바 2015-10-28 18:14:17
불의회상님, 댓글대로 작성하여 테스트할 경우에는 잘 작동하네요. 
https로 redirect 시키려면 어떻게 수정해야 하는건가요?
#3 변종원(웅파) 2015-10-28 18:25:00
그냥 쓰시면 됩니다. https에서 특별히 해줄건 없습니다.
#4 마카바 2015-10-28 18:35:27
아..!!  질문이 잘못되었나봅니다. 

http://example.com으로 접속했을 때에도 
https://example.com 이라고 뜨게 하고 싶은데 
저는 이것이 rewrite 모듈에서 하는 것인줄 알았는데 

이것은 아파치 단에서 conf 파일에서 조정해야하는 것인가요?
#5 변종원(웅파) 2015-10-28 18:49:47
url 포워딩이네요.

아파치단이나 도메인단 또는 프로그램단 모두 가능합니다.

http://www.linuxchannel.net/docs/url_forwarding.txt 참고하세요

게시판 이동합니다.
#6 마카바 2015-10-29 02:26:28
답변들 모두 감사합니다!!

이런식으로 하니까 되네요  

RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

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

RewriteRule를 여러번 쓸수도 있는 것인지 몰랐습니다 
요렇게 하니까 index.php도 없애고, https://로 redirect도 되는 것 같습니다