$config['base_url'] = "http://".$_SERVER['SERVER_NAME']."/project_name/"; this way you config you base_url , then won't worry about in hosting. both works in localhost and server.