Web/Codeigniter
url에서 index.php 제거
moonwoou
2014. 12. 4. 12:21
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'] = '';로 변경한다.