当我将文件从本地部署到我的服务器时,我陷入了重定向循环。CodeIgniter在服务器上的子文件夹中重定向循环
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
该网站是多语言的,我使用.htaccess文件从uri中删除index.php。我试图将网站部署到我的域中的子文件夹(即http://www.mydomain.com/subfolder),理想情况下我想要这样的网址(http://www.mydomain.com/subfolder/en/welcome)
我的.htaccess文件:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
我也曾尝试:
RewriteEngine on
RewriteBase /subfolder/
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
我的config.php:
$config['base_url'] = 'http://www.mydomain.com/subfolder/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
我糅tes.php:
$route['default_controller'] = "home";
$route['404_override'] = '';
$route['^../products/(:num)'] = "products/products_list/index/$1";
$route['^../products'] = "products/products_list/index";
$route['^../products/detail/(:num)'] = "products/product/index/$1";
$route['^../(.+)$'] = "$2";
最后MY_Config类国际化:
class MY_Config extends CI_Config {
function site_url($uri = '')
{
if (is_array($uri))
{
$uri = implode('/', $uri);
}
if (function_exists('get_instance'))
{
$CI =& get_instance();
$uri = $CI->lang->localized($uri);
}
return parent::site_url($uri);
}
}
这种设置工作在我的本地环境很好,我通过http://local.subfolder.com访问,我设置了虚拟主机要做到这一点,但是这当我部署到子文件夹中的服务器时,安装程序不起作用。
如果有人能指出问题所在,我会很高兴。对于这篇长文章感到抱歉,但希望尽可能多地提供信息。
在此先感谢
感谢您的回复,但实际上将uri_protocol更改为REQUEST_URI的确做到了这一点。 – Ozay 2011-03-13 10:00:08