While working with Codeigniter, especially if the server is newly setup or you have transferred the code to a fresh server or hosting, if the login screen works fine but after submitting the login form, 404 error page appears then the most likely cause is the .htaccess file in the root directory (outside application folder)

If you made changes to the php.ini from CPanel, then your existing .htaccess file may have been overwritten by CPanel.

First, check that is present in the .htaccess

Second, check that RewriteBase is pointing to the correct folder. (“/” if the code is on a hosting or VPS)

Next, if you have SSL enabled, checking that the RewriteCond and RewriteRule for https is uncommented

Check that you have changed your database settings in the app/Config/Database.php file

If you are working on an Ubuntu machine (localhost), check that the permission of your folder is 777. If not then run this command

sudo chmod -R 777 /var/www/html/<>

Also, once everything is working fine, make sure to keep a backup copy of your .htaccess file.