Jump to content

mysite.com/username -- How to redirect to profile using htaccess file ??


dilum

Recommended Posts

 

i have built a web site. that is a normal members register web site. so i want to give to member URL like this  www.mysite.com/username.

 

Example if some one type www.mysite.com/username so i want to display his profile with that same URL. like http://www.myspace.com/some_username

 

i think this one has to be solve in htaccess.  i tried lot of time but still i could not find a solution. so i want a help what i have to put to htaccess file and how i can read that from a PHP page (index.php)

:D

Thank you. 

Link to comment
Share on other sites

Thanks for all the reply.

 

But still i have some problem.

 

I added these lines to htaccess file

 

RewriteEngine On

RewriteBase /

RewriteRule ^[a-zA-Z]*$ http://mydomain.com/index.php?username=$1

 

When I type "http://mydomain.com/smith"  Iit redirect to the index page.

This is the URL http://mydomain.com/index.php?username=

But I need that name also (smith) get details for that user. But in that URL passing only  username=

 

So can you help me how to get that name also to a variable?

 

Already i have declare a variable called $username = $_REQUEST['username'];

 

Thanks.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.