CodeIgniter app shows 404 when moved to production

允我心安 提交于 2019-12-10 17:13:44

问题


I've finished developing an app using CodeIgniter in my local machine, and moved it to the production server (live site) yesterday.

My problem is that when I load the site, it immediately shows me a "page not found" error (404). I'm 100% sure this has nothing to do with the server itself, since a clean CodeIgniter installation works perfectly fine.

I've changed the settings in config.php and database.php to reflect the new environment so it's supposed to work. The log file isn't showing anything helpful (only that it can't find index_php after loading the URI library).

Any idea how I can troubleshoot this?

Your help is so much appreciated.


回答1:


Just found the issue. My default controller's file name started with a capital letter. I changed it to small (e.g.: 'example.php' instead of 'Example.php') and it worked.

I've wasted so much time on such a silly error. :(




回答2:


Double-check your Apache configuration. For example, if you're using mod_rewrite to get rid of index.php from the URLs on your local machine, then make sure Apache is configured to do the same in production.




回答3:


Permissions issue? If it can't see the file at all (404), then Apache might not have access.




回答4:


Check what RewriteBase points to in .htaccess in the root directory. Were you perhaps developing in a subdirectory on your local machine, ie http://localhost/devsite? If the live site is not in a subdirectory (ie www.yoursite.ext/site then RewriteBase needs to be /.



来源:https://stackoverflow.com/questions/3948167/codeigniter-app-shows-404-when-moved-to-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!