2012-06-04 5 views
0

나는 codeigniter 사용자 안내서를 확인했지만, 내 문제를 해결하는 것은 운이 좋지 않았습니다.Codeigniter URI 라우팅

로컬 호스트에 웹 페이지를 만들었습니다.

http://localhost/webpage/으로 가면 괜찮습니다. 기본 컨트롤러로 이동합니다.

내 기본 컨트롤러가 Homepage 내가 내 routes.php에 갈 때 index, guaranteeabout

라는 방법이있다, 나는이 추가 :

$route['guarantee'] = "homepage/guarantee"; 
$route['about_us'] = "homepage/about"; 

그런 다음 그것을 http://localhost/webpage/guarantee에 액세스하려고 http://localhost/webpage/about_us 표시 오류 404

하지만 내가 이렇게하면 $route['default_controller'] = "homepage/guarantee"; 보장 페이지가 표시됩니다.

누구든지이 문제를 해결할 수 있습니까? 감사합니다. .

+0

이 폴더에 당신에게'.htaccess' 파일이 있나요? 응용 프로그램 폴더 내부 – rcdmk

+0

,'.htaccess'. 내가 만지지 않았다. 그것은 내가 사용하고 CodeIgniter의의 새 복사본입니다 .. – justin

+1

이있다 괜찮아요. 방금 물었습니까. u가 루트 디렉토리에 추가되었습니다. // 로컬 호스트/웹 페이지/index.php에/guarantee' : 당신은'http로 시도 해 봤나? – rcdmk

답변

1

당신은 index.php를 제거해야합니다.

Options -Indexes 
Options +FollowSymLinks 

# Set the default file for indexes 
DirectoryIndex index.php 

<IfModule mod_rewrite.c> 

    # Activate URL rewriting: 
RewriteEngine on 

# do not rewrite links to the documentation, assets and public files 
RewriteCond $1 !^(uploads|assets|js|css|images|img) 


    # but rewrite everything else 
    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. 
    ErrorDocument 404 index.php 
</IfModule> 
: index.php에이 곳으로 응용 프로그램/config.php 파일 변경에

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

$config['index_page'] = ''; 

그런 다음 같은 폴더에 (루트 폴더에이 htaccess로 파일을 넣어

1

application/config/config.php$config['index_page'] = '';과 같이 $config['index_page']을 공백으로 설정하십시오.