CodeIgniter Forums
how to remove index.php in my URL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: how to remove index.php in my URL (/showthread.php?tid=62862)



how to remove index.php in my URL - nady - 09-03-2015

Dear All
i don't want to show index.php in URL.
how can i call my controller without calling index.php.
for example
i want call my controller like ...

http://localhost/CodeIgniter-3.0.0/HomeController

instead of

http://localhost/CodeIgniter-3.0.0/index.php/HomeController


somebody give following .htaccess file but it's not working. it shows 500 internal error.

------------.htaccess---------------

RewriteEngine on
RewriteCond %(REQUEST_FILENAME)  !-f
RewriteCond %(REQUEST_FILENAME)  !-d
RewriteRule .* index.php/$0 [PT,L]
----------------------------------

looking forward
Thanks in advance


RE: how to remove index.php in my URL - freddy - 09-03-2015

here is is mine

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


then goes to your config/config.php

find

Code:
$config['index_page'] = 'index.php';

change to be
Code:
$config['index_page'] = '';



RE: how to remove index.php in my URL - nady - 09-03-2015

Wow...
Thanks it's working..Smile


RE: how to remove index.php in my URL - PaulD - 09-03-2015

Same as previous post but here are the docs for it:

http://www.codeigniter.com/userguide3/general/urls.html

PS You have () instead of {} in your version.


RE: how to remove index.php in my URL - InsiteFX - 09-03-2015

500 is a server error not a CI error, check your server setup.


RE: how to remove index.php in my URL - CroNiX - 09-03-2015

If you didn't know how to do this, you might want to give the user guide a thorough reading since it's covered in there. I'm sure there's a lot of other things you are unaware of, which would probably be very helpful.