0

I am developing a website in which all members have a provision to set their own url.

For example, my site address is www.example.com.

if a member set his url as www.example.com/his_name, This url is stored in database along with the user id.

When this user enter this url he should get his page.

In my site a common page called profile?id=$id, which displays each person's profile. So when user enter www.example.com/his_name , will display his page..

But there is no page named 'his_name'.

How can I achive this?

Thanks in advance

user3171771
  • 39
  • 1
  • 3

1 Answers1

0

In your .htaccess file:

RewriteEngine On 
RewriteRule ^([a-zA-z0-9]+)$ /profile.php?id=$1 [QSA]

In your profile.php code, you will have to handle the username in $_GET['id'] and then display the appropriate webpage.

You should search for mod_rewrite for more information about this topic.

julienc
  • 19,087
  • 17
  • 82
  • 82