Q:

How can I upload codeigniter website to server it gives me 404?

I upload all the files in folder but when I am trying to open the website it show me file tree like shown in below image. how can I set my all files to run the website correctly.

my base is correct 
$config['base_url'] = 'http://www.xxxxxxx.com/';

My .htaccess file code
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

A:

You first Zip Your files in localhost and unzip it in the server(If you are using cPanel go to filemanager and then to public_html , unzip the file there,).  Then change the base url in config.php
$config['base_url'] = 'http://www.demo.com/';

Create a new database in phpmyadmin with all user privilages. Copy database name, password, db username.
Export Database from your localhost and import to phpmyadmin in you cpanel.
open file database.php  from config folder
upadte the database details
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'DbUserName';
$db['default']['password'] = 'password';
$db['default']['database'] = 'dbName';
$db['default']['dbdriver'] = 'mysql';

upload .htaccess file to your root

