Page 1 of 1

User friendly URL using htaccess

Posted: Fri Sep 18, 2009 4:57 pm
by sunil_23413
Hello
I am working on a site http://mygradregistry.com.
When user goes to link " http://mygradregistry.com/username "
then it should display the content of page "http://mygradregistry.com/profile.php" .
How I can achieve this requirement?
If htaccess is the best method then how I can do it with htaccess?

Re: User friendly URL using htaccess

Posted: Fri Sep 18, 2009 5:01 pm
by requinix
Okay, but I have a question: what if /username already exists? What if the username is "images"?

Re: User friendly URL using htaccess

Posted: Fri Sep 18, 2009 5:07 pm
by ricehigh
I've seen many websites overcoming the problem tasairis describes by assigning a tilde before the username, which means:
This url:
domain.com/~<the username>
becomes this url:
domain.com/profile.php?username=<the username>

I'm sure this site can help you create the proper .htaccess file: http://corz.org/serv/tricks/htaccess2.php

EDIT: alternatively you can have: domain.com/user/<the username> becoming domain.com/profile.php?username?<the username>