我的 codeigniter 在本地主机上完美运行,但在 live 上无法运行。我的 codeigniter 是最新版本。我也尝试旧版本。它总是显示在重定向时找不到页面。
routes.php 设置为
$route['default_controller'] = "home";
$route['404_override'] = '';
我还在服务器上上传了 htaccess。我在 linux 和 window 上都试过了。
访问权限
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
最佳答案
你可以这样做:
$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
关于php - codeigniter 无法在实时页面上工作,在服务器上找不到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9315316/