Welcome Guest, Not a member yet? Register   Sign In
Vanity Urls Extended
#1

[eluser]Kahlil Isaac[/eluser]
Hello Everyone,

I am a student currently working on a project and i decided to use code igniter framework.

I am seeking some assistance as it pertains to further customization of URLs. There are explanation on using username in url eg http://domain.com/username. However i would like to take this a step further.

I would like a visitor to access the same by typing sub domain eg http://username.domain.com and additionally a user if he wish can have his profile accessed by their own domain eg http://usercustomdomain.com

any help on this would be greatly appreciated.

THank you
#2

[eluser]oppenheimer[/eluser]
So the three options are:

http://domain.com/username
http://username.domain.com
http://usercustomerdomain.com

I assume you want to have a single code base with each user having their own data.
How do you want to segment the data? Each user having their own database? Their own tables? their own rows within tables?

There are a couple of options:

<a href="http://ellislab.com/codeigniter/user-guide/general/routing.html">http://ellislab.com/codeigniter/user-guide/general/routing.html</a><br />
<a href="http://ellislab.com/codeigniter/user-guide/general/controllers.html#remapping">http://ellislab.com/codeigniter/user-guide/general/controllers.html#remapping</a><br />

There is also an excellent post from Phil Sturgeon's blog:

<a href="http://philsturgeon.co.uk/blog/2009/06/How-to-Multi-site-CodeIgniter-Set-up">http://philsturgeon.co.uk/blog/2009/06/How-to-Multi-site-CodeIgniter-Set-up</a><br />

You may have to use multiple options to handle all three conditions.
#3

[eluser]Kahlil Isaac[/eluser]
Because this is a small project i would be using one database. I there is information on each user having a database i would not refuse such information.

which ever one give the greatest performance. i forgot to mention how much of a novice i am> lol
#4

[eluser]oppenheimer[/eluser]
I would use the active record class for accessing your database and use the prefix setting in database.php $db[$active_group]['dbprefix'] to give each user their own set of tables. You could set the prefix to the username so your tables would look like this:

Code:
username1_table1
username1_table2
username1_table3
username2_table1
username2_table2
username2_table3

You would need to examine the full URL in database.php to pull out the username for all three cases. You might also need some sort of lookup table for the third case (http://usercustomerdomain.com) to convert usercustomerdomain.com to username. This might be difficult in database.php as I'm not sure you can connect to a database yet. Perhaps for this case, you can create a MY_controller to preform this lookup and set the dbprefix.

Also for the first case (http://domain.com/username/), you would need to use routes.php to direct to the correct controller described in the documentation in my first post.
#5

[eluser]Kahlil Isaac[/eluser]
I have got alot of work to do.

the third case http://usercustomerdomain.com

i see most site gives the user an option to set up an A record in dns that points to the server where the code base is. have to do some more research on that though.

Thanks much




Theme © iAndrew 2016 - Forum software by © MyBB