2017-10-06 2 views
1

나는 codeigniter 3.1.6을 연구 중이다.Codeigniter 3.1.6 - url에서 index.php를 제거하는 방법

.htaccess 파일을 추가했습니다. 또한, 내 프로젝트 경로로 base_url 경로를 변경 index_page에서 index.php을 제거하고 REQUEST_URIurl_protocol을 변경했습니다.

그럼에도 불구하고, 나는 그것이 같은 오류를 던지고있는 컨트롤러 메서드에 URL을 리디렉션하고있는 동안 'The page you requested was not found.'

다른 .htaccess도 검색했지만 적용되지 않았습니다. 만약 내가 base_url의 끝에서 /index.php을 addling한다면, 그것은 작동하지만 잘못된 것입니다. 그것은 index.php없이 작동 할 것입니다. 단지이 문제를 제기 한 3.1.6.

참고 : CodeIgniter의-3.1.4은이 버전이 문제가

+2

가능한 복제 (https://stackoverflow.com/questions/20169545/codeigniter-3-remove-index-php-problems) –

+0

하지만 그 반응. 그래서 여기에 게시했습니다. –

+0

이 질문에 대한 답변을보십시오. 그럼 내가 너를 확실히 도울 것을 알려줘. –

답변

1

config.php에서 CodeIgniter-3.1.6 당신의 base_url

$config['base_url'] = 'http://localhost/ci/ 

사용이 0으로 설정 ci

에 제거 htaccess로이 스크립트 작업에 따라

RewriteEngine On 
RewriteBase /ci 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L] 
[CodeIgniter의 3 제거 index.php에 문제]의
+0

굉장한 형제. 그러나 그것은 모두 진행되고 있습니까? 'RewriteBase/ci'가 누락되면 죽을까요? 다른 버전에서는 havent 같은 줄을 사용하여 여전히 잘 작동합니까? 방법? –

0

1) 편집 config.php를

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

$config['index_page'] = '’; 

2

에게) 만들기를주고 제대로 작동/.htaccess 파일 편집

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

작동하지 않습니다. 벌써 했어. 이 버전에서만 문제가 발생합니다. 나는이 버전을 처음으로 사용하고있다. –

2

사용

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading 
    # slashes. 
    # If your page resides at 
    # http://www.example.com/mypage/test1 
    # then use 
    # RewriteBase /mypage/test1/ 
    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond $1 !^(index\.php|images|robots\.txt|css|docs|js|system) 

    RewriteRule ^(.*)$ index.php?/$1 [L] 
    # If your root folder is at /mypage/test1/ 
    RewriteRule ^(.*?)$ /mypage/test1/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> 

index.php 변경 폴더 이름 $config['index_page'] = '';

+0

Not Working @Sunday –

관련 문제