I've read multiple posts of SO regarding the topic.
How do URL shortener calculate the URL key? How do they work?
Every posts recommends to store the url in the database. It will return you the id, pass the id to a hash function, returning a tiny
id.
My question is what will happen if the same url is requested to shorten it again? Bitly.com returns the same tiny url again for the same url.
What exactly should be the best way to go forward in order to ensure non-duplicate urls??