【发布时间】:2011-01-05 09:25:57
【问题描述】:
我正在尝试将使用 Codeigniter 开发的网站从一台主机移动到另一台主机。主机之间的唯一区别是,要迁移站点的服务器是 Windows 服务器(安装了 PHP 等),而新服务器是 Linux。
但是,当我上传网站并更改所有 url 引用时,该网站只加载主页。
新站点的地址是http://pioneer.xssl.net/~admin341/
有一个htaccess文件,内容如下:
<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
config.php 中与 url 相关的行是:
$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/';
}
}
任何想法将不胜感激。谢谢。
【问题讨论】:
标签: php codeigniter