开发者

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:

  1. URL Rewriting Guide (Apache)
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜