I've seen websites have profile pages do things like 'http://www.example.com/myusername/ show the the person with the username 'myusername's' profile. I was wondering how to do this?
I've seen examples on how to do this with htaccess but it does a full redirect, not allowing post data, get data, etc. How could I do this?
Use .htaccess's mod_rewrite option to create rewrites that will maintain the query string and/or posted data. A quick example (taken from CodeIgniter) :
RewriteEngine on
RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
This will mean that all requests go to index.php and your index.php script would be setup to parse this URL into a proper class and/or function. This allows for a single entry point that can be managed by a system. This is used by all major systems, from Wordpress to Magento to Laravel 4 to CodeIgniter.
.htaccess allows to "post" (the right word would be GET) data in a querystring using a directory-like style You have to activate the RewriteEngine and then write a rule to convert the querystring expected by your page in a directory-style sintax, in order to write these rules you have to use some regular expression to map the elements in the url that will be recognised as the variables and the respective values of you querystring
For example if you want to rewrite a query string like this:
www.sitename.com/showimages.php?album=sea&photo=mysurf
in a query like this:
www.sitename.com/sea/mysurf
you have to write the sequent rule:
RewriteEngine on
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/?$ /showimages.php?album=$1&photo=$2 [NC,L]
here is an interesting and simple guide to ".htaccess URL rewrite" http://edward-designer.com/web/htaccess-url-rewrite-simplified/
I apologize for my bad English
Hope this helps