CodeIgniter error 404 – Tips to fix it!

This is said to be the most common error that occurs on the internet where users would have experienced it more when they go for a browse. This error implicates in terms like frameworks, CMS, etc.

CodeIgniter:

In the way of browsing, users would have little knowledge of getting appropriate results. And remaining, it goes on guess right? Redirection helps the visitor to go for the right page. Do you agree? Then which helps you to redirect as easier? CodeIgniter helps you to create a page called “404 error” which helps in getting user engagement without any diversion. There exist a problem called “CodeIgniter error 404”.

Whenever you get a problem with main.php or .htaccess file it shows an error called “CodeIgniter”. There are several reasons for getting this type of error. We have listed out two cases were you can understand the exact cause of CodeIgniter.

As said already, the problem exists in the main.php and .htaccess file. In this case, you will get a question like how main.php creates a problem.
  • The main.php file must be under the folder called “controllers”. It gives a statement CI_Controller, where Class Main exist in front such as Class Main, extends CI_Controller
  • We need to run a link for identifying the error caused by the .htaccess file. If there is a chance of executing the link and it works then you can conclude that the .htaccess file creates a problem.
Here’s the link:

Your_site_url/index.php/main/cek_login/

You will get a 404 error page when you run this link. So, confirm that you have a problem with the .htaccess file.

Let us find a solution to solve this problem very easily:

We have noticed it many times customers used to get this error often. To deal with the .htaccess file, kindly check whether RewriteEngine is turned on or not! If it shows the off symbol then don’t hesitate to turn in on. Now, you need to set up the RewriteBase.

For setting up the RewriteBase add the below-mentioned code to the .htaccess file.

Code:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
To end up the process, you need to add a code in routes.php. The codes are

Code:
$route['default_controller'] = 'blog';
You need to do this process compulsorily only so, the route.php will have the controller move by default.

By now, your problem will be solved!
Author
bhawanisingh
Views
126
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from bhawanisingh

Top