2012-02-20 6 views
2

'index.php'없이 CodeIgniter URL에 액세스하려고합니다. 여기에 내가 찍은 단계는 다음과 같습니다CodeIgniter URL에서 index.php를 제거하십시오.

  1. 검사의 mod_rewrite는을 사용할 수 있습니다 - 내가 근무하는 구글에 대한 모든 요청을 리디렉션하는 규칙을 설정합니다. 또한 '에 AllowOverride 모두'가 함께

  2. 추가에게 htaccess로 파일을 설정 한 것을 확인 다음과 같은 웹 서버 내 디렉토리 구조를 설정

    RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php/$1 [L] 
    
  3. 은 다음과 같습니다

    /home/wwwsunde/ 
    -> application 
    -> system 
    -> public_html 
        -> index.php 
        -> .htaccess 
    
  4. 내 응용 프로그램/구성 파일을 업데이트하여 시스템 및 pplication 경로는이 URL을

    http://109.234.194.207/~wwwsunde/index.php/welcome/membership WORKS 
    http://109.234.194.207/~wwwsunde/welcome/membership DOES NOT WORK 
    
  5. 나는 또한에 따라 빈에 CodeIgniter의의 인덱스 페이지 변수를 설정 한에서 사이트에 액세스하는 '../system'와 '../application'

  6. 시도이다 오류 메시지가 표시

가이드 :

The requested URL /home/wwwsunde/public_html/index.php/welcome/membership was not found on this server. 

난 오 잘못 될 수 있는지에 관한 아이디어 유타 - 그것은 아파치 또는 서버 문제이다 그러나 나는 확실히 어떤 아니에요 ...

+0

의 index.php가 디렉토리가 아닌 파일? –

+0

http://codeigniter.com/wiki/mod_rewrite에서 지침을 시도 했습니까? –

+0

나는이 사이트를 포함하여 약 1 시간 동안 성공했지만 아무 것도하지 않았다. – codinghands

답변

3

아 ... 내가 아는 이유는 ...이 당신의 재 작성 규칙합니다

RewriteRule .* index.php/$0 [PT] 

당신이 가진 [L]은 '마지막 규칙'이었지만 조용히 백그라운드 셸 게임을 처리하려고 다시 작성하지 않았습니다. 그것은 끝없는 반복 일 것입니다. 그래도 작동하지 않으면 다음과 같이 다시 작성의 전체 URL을 지정하십시오.

RewriteRule .* http://109.234.194.207/~wwwsunde/index.php/$0 [PT] 
+0

404 경로로 변경 당신이 맥이나 뭐 – codinghands

+0

@codinghands 및 서버 이름은 109.234.194.207/~wwwsunde/입니다 : – Ray

+0

그래, 문서 루트는 public_html이 인의 공유 바탕 화면 아파치를 사용하는 경우와 같은, 서버 (구성 BASE_URL에서) 'http://109.234.194.207/~wwwsunde/'입니다. 서버는 WHM/cPanel이 설치된 VPS입니다. – codinghands

1

색인 페이지를 비워 두었습니까? index.php를 의미합니까? 그 결과는 아래와 같습니다 : - 정말 기억하지 않는다 - 그것은 사용자 정의 할 수 있도록 내가 무작위로 우리의 CI 프로젝트 중 하나에서이를 잡고

<?php 
/* 
|--------------------------------------------------------------- 
| PHP ERROR REPORTING LEVEL 
|--------------------------------------------------------------- 
| 
| By default CI runs with error reporting set to ALL. For security 
| reasons you are encouraged to change this when your site goes live. 
| For more info visit: http://www.php.net/error_reporting 
| 
*/ 
     error_reporting(0); 
//  ini_set("display_errors", "on"); 

/* 
|--------------------------------------------------------------- 
| SYSTEM FOLDER NAME 
|--------------------------------------------------------------- 
| 
| This variable must contain the name of your "system" folder. 
| Include the path if the folder is not in the same directory 
| as this file. 
| 
| NO TRAILING SLASH! 
| 
*/ 
     $system_folder = "system"; 

/* 
|--------------------------------------------------------------- 
| APPLICATION FOLDER NAME 
|--------------------------------------------------------------- 
| 
| If you want this front controller to use a different "application" 
| folder then the default one you can set its name here. The folder 
| can also be renamed or relocated anywhere on your server. 
| For more info please see the user guide: 
| http://codeigniter.com/user_guide/general/managing_apps.html 
| 
| 
| NO TRAILING SLASH! 
| 
*/ 
     $application_folder = "application"; 

/* 
|=============================================================== 
| END OF USER CONFIGURABLE SETTINGS 
|=============================================================== 
*/ 


/* 
|--------------------------------------------------------------- 
| SET THE SERVER PATH 
|--------------------------------------------------------------- 
| 
| Let's attempt to determine the full-server path to the "system" 
| folder in order to reduce the possibility of path problems. 
| Note: We only attempt this if the user hasn't specified a 
| full server path. 
| 
*/ 
if (strpos($system_folder, '/') === FALSE) 
{ 
     if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE) 
     { 
       $system_folder = realpath(dirname(__FILE__)).'/'.$system_folder; 
     } 
} 
else 
{ 
     // Swap directory separators to Unix style for consistency 
     $system_folder = str_replace("\\", "/", $system_folder); 
} 

/* 
|--------------------------------------------------------------- 
| DEFINE APPLICATION CONSTANTS 
|--------------------------------------------------------------- 
| 
| EXT   - The file extension. Typically ".php" 
| FCPATH  - The full server path to THIS file 
| SELF   - The name of THIS file (typically "index.php") 
| BASEPATH  - The full server path to the "system" folder 
| APPPATH  - The full server path to the "application" folder 
| MEDIAPATH - The full server path to the "media" folder 
*/ 
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION)); 
define('FCPATH', __FILE__); 
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); 
define('BASEPATH', $system_folder.'/'); 
define('MEDIAPATH', dirname(__FILE__).'/media'); 

if (is_dir($application_folder)) 
{ 
     define('APPPATH', $application_folder.'/'); 
} 
else 
{ 
     if ($application_folder == '') 
     { 
       $application_folder = 'application'; 
     } 

     define('APPPATH', BASEPATH.$application_folder.'/'); 
} 

/* 
|--------------------------------------------------------------- 
| LOAD THE FRONT CONTROLLER 
|--------------------------------------------------------------- 
| 
| And away we go... 
| 
*/ 
require_once BASEPATH.'codeigniter/CodeIgniter'.EXT; 

/* End of file index.php */ 
/* Location: ./index.php */ 

마음은 있지만 확실히 비어 있지. 또한

의 설정 :

$config['uri_protocol']="REQUEST_URI"; 

및 htaccess로 :

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/

    RewriteCond %{REQUEST_URI} ^system.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    RewriteCond %{REQUEST_URI} ^application.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

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

은 'indexpage'변수가 아닌 실제의 index.php 말했다 내 시스템 및이 응용 프로그램 폴더 경로를 설정 한만큼 공정 – codinghands

+0

이 - 내 게시물은 죄송 후 전체에서 아마 쓸모가 –

+0

어떤 사과가 필요하지 않음... :.) 감사합니다. – codinghands

관련 문제