my codeigniter work perfectly on local host but not work at live.my codeigniter is latest version.i also try older.it always show me page not found on redirect.
我的codeigniter完全在本地主机上工作,但不能在live.my codeigniter工作是最新版本。我也尝试old.it总是显示我在重定向上找不到的页面。
routes.php setting is
routes.php设置是
$route['default_controller'] = "home";
$route['404_override'] = '';
i also upload htaccess on server.i tried in linux and window both.
我也在server.i上传htaccess在linux和window中都尝试过。
htaccess
htaccess的
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
1 个解决方案
#1
2
you can do:
你可以做:
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST']; //you can also leave blank this CI tend to find this by himself
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO'; //if not working try one of these:
'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
and try this .htaccess
i use for many sites
并试试这个.htaccess我用于很多网站
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
if not working yet, use a phpinfo();
and check if mod_rewrite is enabled
如果还没有工作,请使用phpinfo();并检查是否启用了mod_rewrite
#1
2
you can do:
你可以做:
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST']; //you can also leave blank this CI tend to find this by himself
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO'; //if not working try one of these:
'PATH_INFO' Uses the PATH_INFO
| 'QUERY_STRING' Uses the QUERY_STRING
| 'REQUEST_URI' Uses the REQUEST_URI
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
and try this .htaccess
i use for many sites
并试试这个.htaccess我用于很多网站
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
if not working yet, use a phpinfo();
and check if mod_rewrite is enabled
如果还没有工作,请使用phpinfo();并检查是否启用了mod_rewrite