CodeIgniter Forums
Codeigniter shared hosting 404 error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Codeigniter shared hosting 404 error (/showthread.php?tid=73614)



Codeigniter shared hosting 404 error - srmarasu84 - 05-14-2019

Hi all,

I am working with codeigniter 3.1.X.Everything is fine in localhost.All working normal with controllers and views.But when i hosted my application in hostgator cPanel the controllers stopped working and 404 error giving.The default controller working but no other controller is working.My .htaccess of application folder is as follows 

<code>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

it is very fine working in local host in all systems but not when hosted through Cpanel. Please help me in this regard i have tried REQUEST_URI index page  index.php.

I have checked for Mod_rewrite enable and it is also fine


</code>


RE: Codeigniter shared hosting 404 error - InsiteFX - 05-14-2019

I have shared hosting and my CodeIgniter runs just fine.

Check to see if it is expecting all lower case filenames etc;


RE: Codeigniter shared hosting 404 error - Wouter60 - 05-14-2019

Leave out the "RewriteBase /" or put a # at the beginning of that line.


RE: Codeigniter shared hosting 404 error - dave friend - 05-15-2019

The most common reason why "it works on localhost, but gives 404 on the live site" is a failure to follow CodeIgniter's file naming requirements.
  1. The first character in the file names of Controllers, Libraries, and Models MUST be uppercase
  2. All other characters in the file name must be lowercase
  3. File names and Class names must be exactly the same

This happens a lot to devs where localhost is no a Windows system and the live server is Linux. The first OS is a case-insensitive, but the later is case-sensitive.


RE: Codeigniter shared hosting 404 error - srmarasu84 - 05-15-2019

(05-15-2019, 07:10 AM)dave friend Wrote: The most common reason why "it works on localhost, but gives 404 on the live site" is a failure to follow CodeIgniter's file naming requirements.
  1. The first character in the file names of Controllers, Libraries, and Models MUST be uppercase
  2. All other characters in the file name must be lowercase
  3. File names and Class names must be exactly the same

This happens a lot to devs where localhost is no a Windows system and the live server is Linux. The first OS is a case-insensitive, but the later is case-sensitive.
But I have tried all..nothing working


RE: Codeigniter shared hosting 404 error - srmarasu84 - 05-15-2019

it is worked once if i changed .htaccess of root folder o the following

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
and changed in config.php
Code:
$config['index_page'] = '';

but only one request it worked fine and total site is hanged..even now home page or any static page is also not working.
 any body help


RE: Codeigniter shared hosting 404 error - php_rocs - 05-15-2019

@srmarasu84,

Can we see the model, view and controller for one of the pages that is receiving a 404 error?


RE: Codeigniter shared hosting 404 error - srmarasu84 - 05-15-2019

Thank god finally it worked..adding .htaccess in root folder is required and no need to add index.php in url.


It is working fine now..thanks to all for quick replies