Reputation: 735
I understand that there may be other questions regarding vanity urls but everyone i see has a different code that i guess does the same job. Therefor i do not understand what rules are best for my personal question, that being said here is my question.
I simply want to create this,
127.0.0.1/website/profile.php?id=1
To this,
127.0.0.1/website/profile/Admin
My sub questions are also,
Thank you for reading, i just can't seem to get my head around .htaccess!
Upvotes: 0
Views: 394
Reputation: 11562
http://localhost/profile/Admin
is really interpreted as http://localhost/website/profile.php?username=Admin
. Only users will see the vanity URL; PHP will still see the URL parameters. In your case, the .htaccess rule will look something like ^profile/([0-9]+)$ profile.php?username=$1
(I obviously don't know for sure since I don't know the architecture of you site).On a side note you might find Virtual Hosts interesting. It's a way of being able to create your own local domain for your site, for example http://my-local-website
instead of using http://localhost/website
or waiting to test in production.
More info here: http://sawmac.com/xampp/virtualhosts/
Upvotes: 1