php, codeigniter

index.php 주소 줄이기

디츠 2014. 10. 8. 22:13

1. /usr/local/apache/conf/httpd.conf

LoadModule rewrite_module modules/mod_rewrite.so // 주석해제
<Directory />
	..
	AllowOverride All // 기본값 "none" 부분을 "All"로 변경
	..
</Directory>

2. /application/config/config.php

$config['index_page'] = '' // index.php 삭제

3. html 루트 디렉토리 .htaccess

<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /
	RewriteCond $1 !^(index\.php|images|captcha|robots\.txt) // 루트 밑에 js(jquery) 폴더를 생성할 경우 |  | 사이에 폴더명 추가 
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^(.*)$ /todo/index.php/$1 [L]
</IfModule>