Welcome Guest, Not a member yet? Register   Sign In
How can I remove sub-folder(controller) name from URL


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?


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

Can anyone help?

maybe You should use routes ?


Why use subfolders in the first place if you don't want the benefit of the URL segment?

[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?

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.

Theme © iAndrew 2016 - Forum software by © MyBB