将地址栏中的url设置为php中的用户名[复制]

This question already has an answer here:

I am developing an website in which, there is registration of users, users can make there profile and lots of stuff like any social networking website.

Now i have made such a thing from scratch that when i or anyone (loggedin as user,having a profile),clicks link to profile of other(i.e friends),a link is set up to such a thing,i.e

www.Highvay.com?users.php?PID=23 (means when i open any accounts of my friend or someone else,i usually have above address in my address bar)

usually i use get variable PID in users.php and then fetch information of that account holder.

$PID=$_GET("PID");
// now do all stuff with databse

Now what i want is whenever an account opens, one should see www.Highvay.com/mukur

mukur is username

For this i tried , changing URL by HTML5's push, but it only changes the url. Means if i enter "www.Highvay.com/mukur" in address bar manually, page is redirected to elsewhere...

how to implement such a thing ...much like facebook (www.facebook.com/mukur.puri) and twitter (www.twitter.com@7mukur7)

</div>

the above ur qustion seems to u need to learn more things currently you fetch user information from user id u should create a one field named username also u need to learn few things about

  • authorization

    • URL rewriting

Create .htaccess file

Check out this link LIink

Options +FollowSymLinks  
RewriteEngine On  

RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f  

RewriteRule ^users/(\d+)*$ ./profile.php?id=$1  
RewriteRule ^threads/(\d+)*$ ./thread.php?id=$1  

RewriteRule ^search/(.*)$ ./search.php?query=$1