2012-02-26 2 views
-6

나는 아파치 서버를 사용하고 codelgniter에 URL에서을 index.php, 나는 그것은합니다 (index.php 파일 제거)에 CI 사용 설명서의 바로 거기의 URI

+11

주십시오. 누가 그런 질문에 업보를 던집니까? * 모든 연구 노력을 보여줄 수 있습니까? – mario

답변

1

당신의 .htaccess 파일을 작성하도록하고이 코드를 추가 해달라고하는 경우 :

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
#Removes access to the system folder by users. 
#Additionally this will allow you to create a System.php controller, 
#previously this would not have been possible. 
#'system' can be replaced if you have renamed your system folder. 
RewriteCond %{REQUEST_URI} ^system.* 
RewriteRule ^(.*)$ /index.php?/$1 [L] 

#When your application folder isn't in the system folder 
#This snippet prevents user access to the application folder 
#Submitted by: Fabdrol 
#Rename 'application' to your applications folder name. 
RewriteCond %{REQUEST_URI} ^application.* 
RewriteRule ^(.*)$ /index.php?/$1 [L] 

#Checks to see if the user is attempting to access a valid file, 
#such as an image or css document, if this isn't true it sends the 
#request to index.php 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 

<IfModule !mod_rewrite.c> 
# If we don't have mod_rewrite installed, all 404's 
# can be sent to index.php, and everything works as normal. 
# Submitted by: ElliotHaughin 

ErrorDocument 404 /index.php 
</IfModule> 

그런 다음 응용 프로그램에서/설정/config.php를 찾을 $의 설정 [ 'index_page를'] = '을 index.php '; $ config로 대체 [index_page '] =' '; 오후 8시 30 분 P.S. Sarfraz가 제공 한 대답은 로컬 컴퓨터에서만 작동합니다. 하나는 전 세계적으로

+0

공식적인 사용자 가이드의 제안과 비교하면 복잡했습니다. – Repox

5

열기 config.php에 작품을 제공 htaccess로 파일에서

$config['index_page'] = "index.php" by $config['index_page'] = "" 

이 uri_protocol의 기본 설정이 제대로 작동하지 않는 경우에 따라서

RewriteEngine on 
RewriteCond $1 !^(index\.php|resources|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

를 추가, 교체. 이 문제를 해결하려면 config.php로 바꾸십시오.

$config['uri_protocol'] = "AUTO" by $config['uri_protocol'] = "REQUEST_URI"