2011-01-05 18 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

ありがとうございます。以前はそれを見かけることはありませんでしたが、治療をしています。 –

+0

あなたは素晴らしいです!この解決策を見つける前に、私の頭を4時間ほど強く叩きました。ありがとう –

関連する問題