I am developing a website based on users dashboard and login and profile. I have an issue with profiles and users.
Can someone explain me how Twitter or even Quora manages to assign every user a special domain like twitter.com/username?
They even do it instantly? I know how to do that like manually, but how do they do it instantly? I know it’s a dumb question, but would be glad if you could help.
Thank you
That is not a domain. It’s a path on the domain. They rewrite domain.com/stuff to a controller. In php, you may route it to domain.com/profile.php?username=stuff. Then, that page queries the database and populates the view with the necessary information.
If you are making a site with profiles and pages, you should not be making an individual profile page for every user – use a “template” and then fill in necessary values. If its a custom page, store things like colors and bg images in the database.
It’s just one SQL query, so it’s pretty fast.
If you are using apache, you can use .htaccess to rewrite the URLs