Codeigniter Issues- Moving Website From Localhost To Live Server

Its always a issue when you move your website from localhost to live server (Regardless of your type of website). but when you are dealing with some  more complicated Framework or Cms, its need to be careful when moving website.

Here we are going to discuss about issue which may occur when you move your codeigniter website.

Codeigniter have “auto connect” feature that will load and instantiate the database class with every page load. To enable “auto connecting”, we only need to add the word database to the library array.

application/config/autoload.php

in this file you can edit auto-load setting of your codeigniter application.

1) First In your case you would create two copies of config.php. One for localhost and one for live server, In your development copy you would have the base URL set to localhost and in the production copy you would have it set to youwebsite.com. this will help to manage both environment when you are transferring your website.

2) 2nd issue you may face regarding your mod rewrite, mod rewrite is an amazing feature of Apache server by which you can make SEO friendly URL for website Simply, mod_rewrite is used for rewriting a URL at the server level, giving the user output for that final page. Codeginitor URL’s always include /index.php with each controller class. so you need to do some modifications to your .htaccess and your mod rewrite should be ON to apply those changes. its mostly happen you are trying your .htaccess file but problem is with mod rewrite engine.

http://codeigniter.com/wiki/mod_rewrite

here are the steps involves in removing index.php from your urls.

3) Codeigniter Sessions, this is issue not at your end and not very common to every server.but i face it when i was transferring my website to fatcow server. Fatcow server was not storing sessions, so that time i edit php.ini file to make enable to store sessions. you also need to give path in php.ini file where you session will be stored.

4) Be careful about use of Case-sensitive issue of codeigniter while redirecting between pages.

example.com/news/article/
my_article is not same as example.com/news/Article/
My_article

it may work fine on localhost but when you will use it on live server it will become problem and will show 404 errors.

  • lhaasiri

    I am not sure if you will see this, but item number (3) is a problem I’m having right now, I think. When I moved from localhost to a live server (using Dreamhost), all of my login/register/search forms STOPPED working! If you see this comment, could you please explain more about how to enable session storage in php.ini? Thank you very much!!

  • Baparoutu Varma

    A step by step detailed blog with screen shots: https://wp.me/p3Osmq-so