PHP Developer,
One way to do this is to use Friendly URLs like mod_rewrite of apache, capture requests and pass them to a file, as most frameworks in PHP do today.
So when a user accesses for example nomedosite.com/yokojoao
he will be accessing nomedosite.com/index.php
passing yokojoao
as a parameter, which your PHP script can handle to identify the user.
Remember that in this URL scheme everything that is passed after nomedosite.com/
would be sent as a parameter to the script.
If you are using Apache and it has mod_rewrite active you should have a file named .htaccess
at the root of the site, yes .htaccess, with nothing before the point and no extension after the access.
The contents of the file can be something like:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^busca/(.*)$ ./buscar.php?query=$1
RewriteRule ^/(\d+)*$ ./login.php?username=$1
In this case the two RewriteConds inform you that conditions trigger the rules below, below are two rules, I put a search to show how you could continue with a few pages after /, if this rule did not exist /busca
would be understood as the username.
The above script redirects any nomedosite.com/usuario
to /login.php
by passing the username to $ _GET ['username'] and if someone searches for nomedosite.com/busca/algumacoisa
it passes $ _GET ['query'] with value of something to ./buscar.php