Want .htaccess to display name instead of id?
I am working on site in which their are user profiles, now I want to display the profiles names or say username through .htaccess. For example: my site have a profile of one user the link is given
http://websoftnet.com/projects/uklasertherapy/?page_id=62&th_id=3
and I 开发者_StackOverflow中文版want .htaccess to display this
http://websoftnet.com/projects/uklasertherapy/profile/saeed
How can I do this through .htaccess?
The technique is called URL Rewriting. Check this sites out:
- URL Rewriting Guide (Apache)
- URL Rewriting (Your HTML Source)
Warning: Untested code
You need to have a .htaccess file along the lines of
RewriteEngine on
RewriteRule ^projects/uklasertherapy/profile/([a-zA-Z])/$ projects/uklasertherapy/profile.php?name=$1
Where profile.php
would take the variable name
from the GET parameter and get the page for the user with that name.
精彩评论