0

Im having this issue:

I have a URL for example:

http://www.example.com/home

in which 'home' is the name of the controller calling his index function. Everything works fine in here but I want to call that home controller but only showing base url like this:

http://www.example.com

Anyone knows how to do this? Setting routes like this:

$routes[''] = 'Home';

It doesn't work for me.

Thanks in advance for any information.

  • What is the version of your codeIgniter ? – Prakash Saini Nov 26 '16 at 03:10
  • Possible duplicate of [How to remove controller name from url making it clean in codeigniter](http://stackoverflow.com/questions/12863095/how-to-remove-controller-name-from-url-making-it-clean-in-codeigniter) – Veerendra Nov 26 '16 at 06:02
  • I have Codeigniter version 3.1.2 And cant be duplicate because in that answer he wants his URL as http://localhost/ci/home and I want it to be only http://localhost – Marvin Calderon Nov 26 '16 at 14:15

1 Answers1

2

In your application/config/routes.php you just need to set the default controller...

$route['default_controller'] = 'home';
TimBrownlaw
  • 5,457
  • 3
  • 24
  • 28
  • I have it like that and its giving me http://localhost/home and I want it without the 'home' word.. Please help – Marvin Calderon Nov 26 '16 at 14:16
  • @MarvinCalderon............How? When you initially setup codeigniter it has the welcome controller configured as the default controller so you do NOT NEED To type in example.com/welcome, as using example.com calls it by default due to the route setting. So how in the goodness of everything good is it "Giving you localhost/home"? What else are you not telling us? – TimBrownlaw Nov 27 '16 at 05:26