Welcome Guest, Not a member yet? Register   Sign In
how to remove index.php in my URL
#1
Exclamation 

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...Controller


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
Reply
#2

(This post was last modified: 09-03-2015, 03:17 AM by freddy. Edit Reason: change code )

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'] = '';
Reply
#3

Wow...
Thanks it's working..Smile
Reply
#4

(This post was last modified: 09-03-2015, 06:44 AM by PaulD.)

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.
Reply
#5

500 is a server error not a CI error, check your server setup.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB