In the root of the website you would make a .htaccess file (take care when naming it, the htaccess part is the file extension, there is no filename). Within that file put this:
Code:
RewriteEngine on
RewriteRule ^(.*)$ index.php?username=$1
Then, in the index.php file you can just use $_GET['username'] to select the relevant userdata (don't forget to sanitise it though).
The only downside to a system like this is, if you have say /about or /contact the script will try and load users with that name. You can stop that by modyfying your htaccess file like so:
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?username=$1
Now apache will check any requests to see if a file or directory with that name already exists and if so load that instead. And yes, this system is very search engine friendly because as far as the search engine is concerned these are separate pages.
Bookmarks