我的codeigniter完全在本地主机上工作但不能在live.my中工作.codeigniter是最新版本。我也尝试old.it总是显示我在重定向上找不到页面。
routes.php设置为
$route['default_controller'] = "home";
$route['404_override'] = '';
我还在server.i上传了htaccess,在linux和window中都尝试过。
htaccess的
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
答案 0 :(得分:2)
你可以这样做:
$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
并尝试使用.htaccess
我用于许多网站
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
如果还没有工作,请使用phpinfo();
并检查mod_rewrite是否为enabled