2011-01-05 2 views
0

Codeigniter에서 개발 된 사이트를 한 호스트에서 다른 호스트로 이동하려고합니다. 호스트 간의 유일한 차이점은 사이트가 이동하는 서버가 Windows 서버 (PHP 등이 설치됨)이고 새 서버가 Linux라는 것입니다.Codeigniter에서 개발 된 사이트에서만 홈 페이지가로드됩니다.

그러나 사이트를 업로드하고 모든 URL 참조를 변경하면 사이트는 홈 페이지 만로드합니다.

새 사이트의 주소는 다음과 같이 읽 htaccess로 파일이 http://pioneer.xssl.net/~admin341/

입니다 :

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/

#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] 

#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] 

우리가 mod_rewrite를 설치하지 않은 경우, 모든 # 404의 #을 index.php로 보내면 모든 것이 정상적으로 작동합니다. 에 의해 제출 # : ElliotHaughin

ErrorDocument 404 /index.php 

URL에 관련 config.php에의 선은 다음과 같습니다

$config['base_url'] = "http://pioneer.xssl.net/~admin341/index.php/"; 
$config['index_page'] = ""; 

플러스 개발자 (내 전임자)는 URL 헬퍼 파일을 코딩 :

function base_url($includeIndexPHP = true) 
{  
    if($includeIndexPHP) 
    { 
     $CI =& get_instance();  
     return $CI->config->slash_item('base_url'); 
    } 
    else 
    { 
     return 'http://pioneer.xssl.net/~admin341/'; 
    } 
} 

모든 아이디어를 얻을 수 있습니다. 감사.

답변

3

라이브 사이트에서 제대로 작동하려면 $ config [ 'uri_protocol']을 변경해야 할 수도 있습니다. 이것은 종종 CodeIgniter의 "홈페이지 만"라우팅 문제의 원인입니다.

가장 일반적인 것은 REQUEST_URI이지만 PATH_INFO가 더 잘 작동하는 경우가 있습니다.

+0

감사합니다. Phil. 이전에 그런 일을해서는 안되지만 대우를받습니다. –

+0

당신은 위대합니다! 이 솔루션을 찾기 전에 거의 4 시간 동안 내 머리를 터트렸다. 감사 –

관련 문제