Direction for /username/ instead of a $_GET

Hi there,

My website today is currently using ?username=$username for the profile.php pages. I’m wondering what I need to do to change this to a domain specific type of profile page. A bit like many sites we have today such as twitter and facebook. The reason why I’m not searching google for this is because I’m uncertain how we call this.

If anyone can put me in the right direction with what I should know before getting into this?

Also is there anything wrong with the $_get method aside from it being not aesthetically pleasing?

Thanks in advance.

You can do this with mod_rewrite.

The most basic case is you write a .htaccess file and put that in the / directory of your site.
In that .htaccess file you put the following:

Options +FollowSymlinks

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/$ profile.php?username=$1 [L]

That will map any request that does not resolve to a valid directory/file to profile.php with as username the URL that was given, i.e., /scallioxtx/ resolves to profile.php?username=scallioxtx

You can find a good tutorial on mod_rewrite on