CodeIgniter Forums
personal urls - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: personal urls (/showthread.php?tid=24840)



personal urls - El Forum - 11-21-2009

[eluser]decob[/eluser]
looking to add a feature for members of a site where they would have a personal url based on their first name, www.example.com/john which would obviously map to the main controller,

Given that the majority of the site is actually flash with some data being pulled in fron codeigniter, i'd need that controller not to be mapped back to the main controller.

At some stage in the future i may check the entered names against a database to ensure it's an allowable name.., as i'd rather not have people being able to enter any random crap like
www.example.com/isacrapwebsitename

So question is, whats the best approach, routes or some form of mod_rewrite magic


personal urls - El Forum - 11-22-2009

[eluser]Ben Edmunds[/eluser]
Is this a question?

If you are just asking how to do this, use routes.


personal urls - El Forum - 11-22-2009

[eluser]tkyy[/eluser]
i have solved this problem several ways in the past. whatever it is you do make sure you do a scandir of the controllers folder and blacklist any names of files contained there when a user creates his/her account.

don't hardcode it- had this happen to me once!


personal urls - El Forum - 11-22-2009

[eluser]decob[/eluser]
yeah found one solution that allowed any string to be mapped to a controller, and a blacklist of used contoller names, thinking of also having an allowable list that is checked.
I haven't tried it yet but can i make a db call from the routes.php?


personal urls - El Forum - 11-26-2009

[eluser]alrightythen[/eluser]
I'm having trouble planning this type of feature. Can someone help me get on my way? How does routes help me?

I want to have these kinds of urls...
http://www.example.com/username -> which are dynamic
http://www.example.com/about -> which are made by me in de controller

What's the best practice for this?

I've been thinking a uri to "members/username" then rerouting to http://www.example.com/username should do the trick but what if the user wants to manually type http://www.example.com/username.

I understand the techniques explained above but I can't find actual information in the user guide or internet to help me get started with this.

Thanks.


personal urls - El Forum - 11-26-2009

[eluser]decob[/eluser]
the solution i found on another thread, last item...

http://ellislab.com/forums/viewthread/129407/

i'm looking at maybe also having a white list of alloweable names, tho would need to test it for speed as i'd have quite a few names to allow. My concern was people could enter any old crap and it appear as a page


personal urls - El Forum - 12-21-2009

[eluser]jimps[/eluser]
Sorry for bumping old thread. Many tabs up in my browser.