[SOLVED] www.mysite.com/username/method/.. Impossible? |
[eluser]markanderson993[/eluser]
Hello CodeIgniter gods! I was wondering if it would be possible to get Codeigniter to recognize if the first uri segment (the controller) is a username and do the following: Traditional Uri Schema www.mysite.com/controller/method/.. Changed to this to.. www.mysite.com/username/method/.. ? The latter option would require Codeigniter to check the controller request each time against a database full of users to determine if a username match exists. If not, just load in the traditional uri. Is this possible? If so, how might I achieve this?! Any help is greatly appreciated! Thank you very much in advance, Mark Anderson
[eluser]SpooF[/eluser]
You can do something like this: Place this in your routes. Code: $controllers = array(); This will create a route for all your controllers (stops the last one from matching everything), if the controller doesnt exists it will default to the users controller. If you separate your controllers into groups via folders you will have to modify the script a little.
[eluser]Jake Grice[/eluser]
You might also be able to use mod_rewrite and distinguish mysite.com/sometext/othertext from mysite.com/index.php/controller
[eluser]markanderson993[/eluser]
Thank you very much for your suggestions! I appreciate the help very much! Mark Anderson |
Welcome Guest, Not a member yet? Register Sign In |