我的 codeigniter 在本地主机上完美工作,但在 live 上无法工作。我的 codeigniter 是最新版本。我也尝试较旧的版本。它总是显示在重定向上找不到的页面。
routes.php 设置是
$route['default_controller'] = "home";
$route['404_override'] = '';
我还在服务器上上传了 htaccess。我在 Linux 和 Windows 中都尝试过。
htaccess
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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)