Codeigniter show 500 server error on htaccess issue in bluehost

Codeigniter show 500 server error on htaccess issue in bluehost

Htaccess is a good way to improve our websites performance, optimize loading time and keep secured from various kinds of attack. But, sometimes htaccess gives us a lots of pain. There are many web hosting provider over the internet and they frequently upgrade their server to improve server performance. Blue host is one of most popular hosting provider and they provide good service for PHP based websites with affordable cost.

Last day worked on a Codeigniter based client project. Client requirement was to make all URLs SEO friendly using htaccess. Everything was working fine for me in localhost, but after uploading files in server it was showing me 500 internal server error. I was bit confused why such type of problem occurred ?

First time I thought it might be an issue of Codeigniter version. Because I used 1.7.2 version when project was first deployed more than one year ago. So according to my plan, I upgraded Codeigniter version 2.0.3 and again uploaded in server and found same 500 error problem. I’d some experience about the reasons of 500 internal server error. But, main reason of 500 internal server error is misconfiguration in htaccess file. I’d opened htaccess file and write following code and issue solved.

– htaccess snippet for solving 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]

Finally, what I learned from it, I just need to define your folder name in htaccess file. I was worked in this issue more than 3 hours and finally got the solution. There is no big change in htaccess file and it’s very simple.

Hope my htaccess tips will help you to solve 500 internal server error.  Enjoy!

Back To Top