CodeIgniter Forums
How can I remove sub-folder(controller) name 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: How can I remove sub-folder(controller) name from URL (/showthread.php?tid=49763)



How can I remove sub-folder(controller) name from URL - El Forum - 03-02-2012

[eluser]veledrom[/eluser]
Hi,

I have many sub folders under controller folder. When I call a class under any of those sub folders, I see sub folder name attached to the URL. I want to remove folder name from URL but how do I do it?

EXAMPLE:

Folder structure: application/controller/<b>mysubfolder</b>

URL: localhost/index.php/<b>mysubfolder</b>/class/method

How can I remove <b>mysubfolder</b> wording? I have many folders so It has to be dynamic solution.

Thanks in advance


How can I remove sub-folder(controller) name from URL - El Forum - 03-03-2012

[eluser]veledrom[/eluser]
Can anyone help?


How can I remove sub-folder(controller) name from URL - El Forum - 03-05-2012

[eluser]Unknown[/eluser]
maybe You should use routes ?


How can I remove sub-folder(controller) name from URL - El Forum - 03-05-2012

[eluser]timpiele[/eluser]
http://ellislab.com/codeigniter/user-guide/general/routing.html


How can I remove sub-folder(controller) name from URL - El Forum - 03-05-2012

[eluser]Aken[/eluser]
Why use subfolders in the first place if you don't want the benefit of the URL segment?


How can I remove sub-folder(controller) name from URL - El Forum - 03-06-2012

[eluser]veledrom[/eluser]
[quote author="Aken" date="1331004224"]Why use subfolders in the first place if you don't want the benefit of the URL segment?[/quote]

Because I have massive project to deal with. Wouldn't it be messy having all the controllers under /controllers/ folder? I'm just asking, do you think having separate folders better approach or not? How do I benefit from URL segment in this case though?


How can I remove sub-folder(controller) name from URL - El Forum - 03-06-2012

[eluser]Aken[/eluser]
Your app would benefit from subfolders if you want to actually utilize the URL benefits of the subfolders - more info here.

Think of it like a half-assed module system. If you have controllers you want to prefix, for example: /admin/controller/method/param, then create an admin folder. If you don't want that prefixed "directory" (aka /controller/method/param), then put your controllers in the main folder.

Or, if your app really is as huge as you say, consider a much more modularized solution that separates everything, not just controllers.