.htaccesscodeigniterbluehost

Removing index.php from the url in codeigniter


I recently started using codeigniter, and I've got it hosted on Bluehost here: http://dev.fuelingtheweb.com/codeigniter/.

If I included index.php in the path like this: /codeigniter/index.php/hello, everything works fine, but if I try to access the page without index.php like this: /codeigniter/hello, I get a 500 Internal Server Error. I have tried numerous .htaccess options, but nothing seems to work.

Currently, my .htaccess file is locating here: /codeigniter/.htaccess and it includes the following code:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /codeigniter/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.+)$ codeigniter/index.php/$1 [NC,L,QSA]
</IfModule>

<IfModule !mod_rewrite.c>
  ErrorDocument 404 index.php
</IfModule>

Also, my config file (/codeigniter/application/config/config.php) includes the following:

$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

I tried all 5 protocol options with no success.

Any help with this would be greatly appreciated.


Solution

  • Did you try the one from user guide?

    https://www.codeigniter.com/user_guide/general/urls.html