profiles in url

hello
10 Replies
NIMA
NIMAOP4w ago
i see in some website for make online profile they do something so everyone can make a account with unique username and they can serch for their account in url with the user name like this https://x.com/[ any name ] how this is possible ?
Jochem
Jochem4w ago
the most common way is to use mod_rewrite in apache, which lets you rewrite the URL from the request after it hits the server but before it's processed nginx has a similar system You can either set it all up in your webserver, or have mod_rewrite redirect all traffic to a router in your application, which then does its magic to load and display the correct page.
NIMA
NIMAOP4w ago
so this mod_rewrite will edit only url right ? but it send the user in another loction
Jochem
Jochem4w ago
it rewrites the URL internally, the user doesn't see the change so for example while you see x.com/nima, the server sends the request to x.com/user.php?username=nima
NIMA
NIMAOP4w ago
ohh now it make sense is it possibel to use it in php ? mod_rewrit
Jochem
Jochem4w ago
you mean using the builtin PHP server? Not really, afaik
NIMA
NIMAOP4w ago
so only way is with apache
Jochem
Jochem4w ago
not quite there's other ways to accomplish this. Another common way is to use a router script, and mod_rewrite (or use some other method) to send all traffic to the router script. You can do that with php's internal server too I generally prefer to use apache in dev environments too though, mostly cause you can use mod_rewrite and other .htaccess directives
NIMA
NIMAOP4w ago
tnx i will try apache
Want results from more Discord servers?
Add your server