3

I’m currently in the process of development and thinking about URL structure. For example social networks make it possible to specify usernames after a slash that seems logical.

As a result, the structure turns into something like example.com/username/(blog, account, album, etc.), but here there is a problem – once a user is registered, he\she gets an ID. Much time can pass before the user decides to customize URL address, so search engine already may have in its DB links like example.com/id12345. Later user can customize\change URL again, then in a month again, and then again in a six months.

Here there are questions:

  1. How social networks solve such issue? What is the algorithm? Does DB do record of all address changes that this user has made and in case if there is a request of ‘old’ URL, redirection occurs to the new one?

  2. How to act in cases when this user lets say have made 3 changes, in all cases giving different names, such as star, firefly, qwerty? What if after all these changes, the other user wants to take a firefly, which the 1st user had sometime ago?

  3. After all, if to allow the 2nd user to use already freed firefly address, there is a chance (albeit small) that redirection would be made to the 2nd user, instead of the 1st one. Forbid to other users to use someone’s previously used names?

1

1) Facebook, for example, used to give you a numeric (i.e. 1000000001) id, now i guess they automatically establish you one (alphanumeric) related to your name/etc at first, and don't change. The old (numeric) ones, after first changed, becomes final. The old URL probably has a 301 redirect to the new (and final) one. I don't think is reasonable for any DB recording of your old nicks (except for management/log purposes) to redirect to your new ones, it's basically duplicate urls.

2) In that case, username should be free. Depends on business logic too. But they also limit it by X changes per Y time.

3) The redirect will be to whatever the code sends it to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.