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

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

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

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

[eluser]timpiele[/eluser]
http://ellislab.com/codeigniter/user-gui...uting.html
#5

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

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

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




Theme © iAndrew 2016 - Forum software by © MyBB