CodeIgniter Forums
Hiding class from url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Hiding class from url (/showthread.php?tid=9861)



Hiding class from url - El Forum - 07-10-2008

[eluser]Nial[/eluser]
I'm trying to avoid having to place my default CI controller within a url. For example, I have a default controller: welcome. The controller has two classes: index and info. When I navigation to: http://mysite.com/ the default welcome controller is called and the code in index is executed, as expected. However, where I would like to be able to navigate to http://mysite.com/info/ to trigger the info message, I get a 404 error. Instead, I must navigate to http://mysite.com/welcome/info.

What baffles me is that with another CI project, this works perfectly. I've dug around, and I'm not doing anything different with regards to .htaccess (I simply hide index.php), or routes (all I define is the default controller). I'm certain I must have done something to initiate this behaviour, but I've forgotten what!

Any suggestions?


Hiding class from url - El Forum - 07-10-2008

[eluser]richthegeek[/eluser]
you need to look at routes


Hiding class from url - El Forum - 07-10-2008

[eluser]Nial[/eluser]
I've looked at routes, as I stated in my initial post. My other CI project doesn't have any specific route settings, other than the default controller.


Hiding class from url - El Forum - 07-10-2008

[eluser]richthegeek[/eluser]
does it have an info controller?


Hiding class from url - El Forum - 07-11-2008

[eluser]Nial[/eluser]
No, the welcome controller has an info method.


Hiding class from url - El Forum - 07-11-2008

[eluser]xwero[/eluser]
Does your other project has a MY_router.php file? (located in the application/libraries directory)


Hiding class from url - El Forum - 07-11-2008

[eluser]Yash[/eluser]
did u set base_url??


Hiding class from url - El Forum - 07-11-2008

[eluser]insub2[/eluser]
[quote author="Nial" date="1215744979"]...routes (all I define is the default controller)...[/quote]

the only route set is the default controller like this:
Code:
$route['default_controller'] = "welcome";
is that correct?

is there anything like this?
Code:
$route['info'] = "welcome/info";