4

페이지를 리디렉션하는 동안 codeigniter를 처음 사용합니다. index.php가 기본적으로로드되지 않으므로 htaccess 파일에서 아래 코드를 시도했습니다. PHP 5.3.10, 아파치 서버 및 포스트그레스 데이터베이스를 설치했습니다. 그래서 새로운 설정이 .htaccess와 httpd.conf를 변경하는 것 외에는해야한다면 알려주세요. 이전 질문에 동일한 문제에 대해 물어 보았습니다. 그런 질문에서 모든 것을 언급했지만 여전히 해결할 수는 없습니다. 끝내야 할 여분의 일을 알려주십시오.codeigniter 리디렉션이 index.php없이 작동하지 않습니까?

htaccess로 파일

<IfModule mod_rewrite.c> RewriteEngine On #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 #This last condition enables access to the images and css folders, and the robots.txt file RewriteCond $1 !^(index\.php|public|images|robots\.txt|css) RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> 
    RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^/(index\.php|assets/|humans\.txt) RewriteRule ^(.*)$ index.php/$1 [L] 
    RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule .* index.php/$0 [PT,L] 

httpd.conf 파일 로컬 호스트

<Directory /> 
    Options FollowSymLinks 
    AllowOverride All 
    Order deny,allow 
    Deny from all 
</Directory> 
+0

도움이 될 수 있습니다. http://stackoverflow.com/questions/20188957/removing-index-php-offical-guide-not-working-code-igniter?rq=1 – Pooshonk

+0

다시 쓰기 모듈을 사용할 수 있습니까? – lyhong

+0

'application/config/config.php'에서'$ config [ 'index_page'] = '';'를 확인하십시오 –

답변

2

URL에서 index.php를 피하기 위해해야 ​​할 일들

  • 항상 .htaccess 파일이 있는지 확인하십시오. 당신은 이미 가지고 있습니다.

  • @charlie가 위에 제안한 .htaccess에 내용을 포함하십시오.

  • 편집을 httpd.conf 나노 명령을 사용하여 파일 및 모든

  • 먼저 해제 재 작성 모드를 allowoveride 유지 한 후 다음 명령을 사용하여 아파치 서버를 다시 시작 다시 활성화 중요한 것은이 포함됩니다.

    sudo를 다시 쓰기 모드를 아파치를 다시 시작

    sudo는 서비스 아파치를 다시 시작 // 수

    sudo는이 // 다시 a2enmod 재 작성 모드를 사용 불가능하게 //를 다시 a2dismod

그게 전부입니다. 모두 제일 좋다.

1

당신의 .htaccess 파일이 붙여 넣기 서버 이름

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

@Charle Sir,이 코드는 작동하지 않습니다. –

관련 문제