2013-03-22 3 views
0

웹 루트에 내 codeigniter 코드가 있습니다. mod_rewrite가 활성화되었습니다. phpinfo.php를 통해 확인했습니다. 이제 코드 구조는이CodeIgniter가 하위 폴더와 작동하지 않습니다.

controllers/home.php(default controller) 
    controllers/products.php (not listed in routes.php under config) 
    and then a subfolder 
    controllers/members/login.php 

같은 내가 노력하고 URL이

입니다입니다
domain_name/ ---------> works 

(참고 : 나는 생각에 내 에코 BASE_URL이 나를 가리키는 곳이다 때문에 $의 설정 [ 'index.php에'] = '',하지만도의 index.php로 설정하면 이

domain_name/products ------> doesn't work 
    domain_name/index.php/products ------> works 
    similarly 
    domain_name/members ----->doesn't work 
    domain_name/index.php/members --->work 
) 작업 index.php에 URL로 나를 가리키는 아니다

이 문제는 index.php와 작동하기 때문에 routes.php가 정상적으로 작동하고 있다고 생각합니다. 하지만 echo_base_url이 index.php urls없이 나를 가리키고있는 방법이 있습니다.

난은/var/www가가/ CodeIgniter를위한 버전 도와주세요 2.1.3

입니다 내 웹 루트에있는 .htacess 파일을 시도했습니다. index.php의 유무에 관계없이이 작업을 수행하고 싶습니다. 그리고 내가 누락 된 부분을 설명 할 수 있다면 설명해주십시오.

답변

0

일반적으로 Codeigniter는 주 루트를 호출 할 때 index.php를 숨기 쉽지만 url .. index.php에서 직접 하위 폴더에 액세스하려고 할 때 index.php를 숨길 수 있습니다.

그래서이 .htacess을 포함하고 CI 폴더 이름에의 재 작성 기준을 변경하려고 도메인/제품 또는 도메인/index.php에/제품의 사용을 허용됩니다 CI 파일 시스템 내부의 .htaccess

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase /cifolder 

    #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> 
관련 문제