全新安装codeigniter 404错误或下载每页

时间:2022-03-25 07:58:11

I am migrating from an old Linux server to a new Linux server and have a fresh install of codeigniter on the old one that works perfectly. Transfer it to the new server however, and it gives me a 404 error on the 'home page' (just the domain or the direct route - http://mydomain.co.uk/welcome) or, if I include index.php it attempts to download it!

我正在从旧的Linux服务器迁移到新的Linux服务器,并且在旧的服务器上安装了一个完全正常工作的codeigniter。然而,将它转移到新服务器,它在'主页'(只是域或直接路由 - http://mydomain.co.uk/welcome)上给出了404错误,或者,如果我包含index.php它试图下载它!

This is my .htaccess file:

这是我的.htaccess文件:

options +followsymlinks
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|images|module_uploads|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

the base url is correct and $config['index_page'] = '';

基本网址是正确的,$ config ['index_page'] ='';

This is all it takes to run the millions of codeigniters installs I've got on my old server so I've no idea where to start!

这就是运行我在旧服务器上安装的数百万个codeigniters所需的一切,所以我不知道从哪里开始!

I've Googled it all and tried adjusting slashes in the .htaccess file and I've added and removed index.php in the $config['index_page']; so I'm not sure where to go from here. Any help appreciated.

我用Google搜索了所有内容并尝试调整.htaccess文件中的斜杠,并在$ config ['index_page']中添加并删除了index.php;所以我不确定从哪里开始。任何帮助赞赏。

2 个解决方案

#1


1  

Go to the config.php file in your application/config folder and go down to where it says $config['index_page'] = 'index.php'; and delete the index.php part. So it just says $config['index_page'] = '';

转到application / config文件夹中的config.php文件,然后转到$ config ['index_page'] ='index.php'的位置;并删除index.php部分。所以它只是说$ config ['index_page'] ='';

Hope that helps!

希望有所帮助!

#2


0  

Thanks for all your help. It turns out after being told by my server people over and over that it's my code that's the problem (tell that to CodeIgniter), it turns out my old server used Apache and my new one uses Fast-CGI. But no-one told me! I've had it changed to Apache and, would you believe it, everything works fine. Hmmm. Not my code then is it. Thanks all.

感谢你的帮助。事实证明,我的服务器人员一遍又一遍地告诉我,这是我的代码问题(告诉CodeIgniter),事实证明我的旧服务器使用了Apache而我的新服务器使用的是Fast-CGI。但没有人告诉我!我把它改成了Apache,你相信它,一切正常吗?嗯。那不是我的代码。谢谢大家。

#1


1  

Go to the config.php file in your application/config folder and go down to where it says $config['index_page'] = 'index.php'; and delete the index.php part. So it just says $config['index_page'] = '';

转到application / config文件夹中的config.php文件,然后转到$ config ['index_page'] ='index.php'的位置;并删除index.php部分。所以它只是说$ config ['index_page'] ='';

Hope that helps!

希望有所帮助!

#2


0  

Thanks for all your help. It turns out after being told by my server people over and over that it's my code that's the problem (tell that to CodeIgniter), it turns out my old server used Apache and my new one uses Fast-CGI. But no-one told me! I've had it changed to Apache and, would you believe it, everything works fine. Hmmm. Not my code then is it. Thanks all.

感谢你的帮助。事实证明,我的服务器人员一遍又一遍地告诉我,这是我的代码问题(告诉CodeIgniter),事实证明我的旧服务器使用了Apache而我的新服务器使用的是Fast-CGI。但没有人告诉我!我把它改成了Apache,你相信它,一切正常吗?嗯。那不是我的代码。谢谢大家。