Fixed 500 error using htaccess of a Codeigniter application

Codeigniter show 500 server error on htaccess issue in bluehost

Like the other day, I was working on a Codeigniter based web application for a client. Client was hosted the site on, and the requirement was to create SEO friendly URL structure for the site. They specifically wanted to do that using htaccess method.

Everything was working fine for us in the localhost environment. However, once we uploaded all the files in the live server, site was unable performing accurately, and displaying 500 internal server error. I was a bit confused, why this type of issue occurred, and try to figure out the possible reasons. After working few hours on that particular issue, finally I resolved the issue and here goes the solution of that 500 issue.

htaccess To Fix 500 Error:

#write your project folder name as rewritebase
RewriteBase /your_folder_name/

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*) index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+) index.php?/$1 [L]

Possible Reason for 500 Error:

Firstly, I assumed it might be an issue of the Codeigniter version. I had installed on the 1.7.2 version when the project was deployed originally more than a year ago. So, I decided to remove the older version and re-install the latest version 2.0.3 of Codeigniter. According to the plan, Codeigniter version had been updated, but, got the same 500 error problem.

Now, it confirms that, the reason for the 500 internal server error was for the incorrect htaccess code. So, I opened the htaccess file, and applied the aforementioned code, and finally that fixed 500 internal server problem.

Reason to Use htaccess:

htaccess is an excellent way to improve the websites performance, optimize loading time and keep secured from various kinds of attack. Occasionally, htaccess can generate a few issues due to the server configuration. However, web hosting providers like – , across the internet frequently upgrade their server to improve service performance. So, any issue related to the server you can easily contact to them.

Hope that htaccess method helps you, as well as solve 500 internal server error. If you come up with a new issue, let me know in the comment section below.

Total 0 Votes

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Comment

Back To Top