본문 바로가기

Web/Codeigniter

url에서 index.php 제거

http://seoljoo.tistory.com/index.php/board/lists 와

http://seoljoo.tistory.com/board/lists 중에 어느 주소가 보기 좋을까.

당연히 후자.


그러나 codeigniter에서는 기본적으로 index.php가 붙은 주소가 나온다.

우리는 이 index.php를 제거 해야한다.


+ 방법

index.php가 있는 곳에(루트) .htaccess 파일을 생성한다.

그리고 내용은 아래와 같이 입력한다.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 


그리고 codeigniter가 설치된 폴더 안에서

application/config/confing.php라는 파일을 찾는다.


파일의 내용 중

$config['index_page'] = 'index.php';를

$config['index_page'] = '';로 변경한다.

'Web > Codeigniter' 카테고리의 다른 글

JSON 구조화된 모양으로 받기 (JSON_PRETTY_PRINT)  (0) 2015.04.02
프로시저 호출  (0) 2015.03.27
개발환경 세팅  (0) 2014.12.18
CodeIgniter란  (0) 2014.12.12