User friendly URL using htaccess

Discussion in 'PHP' started by sunil_23413, Sep 18, 2009.

  1. #1
    Hello
    I am working on a site http://mygradregistry.com.
    When user goes to link " http://mygradregistry.com/username "
    then it should display the content of page "http://mygradregistry.com/profile.php" .
    How I can achieve this requirement?
    If htaccess is the best method then how I can do it with htaccess?
     
    sunil_23413, Sep 18, 2009 IP
  2. Oli3L

    Oli3L Active Member

    Messages:
    207
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Try this:

    
    
    Options +FollowSymLinks
    RewriteEngine on
    
    RewriteRule (.*)$ profile.php?username=$1
    
    
    
    Code (markup):
     
    Oli3L, Sep 18, 2009 IP
  3. wvccboy

    wvccboy Notable Member

    Messages:
    2,632
    Likes Received:
    81
    Best Answers:
    1
    Trophy Points:
    250
    #3
    When you say display content of the page are you referring to something like what stated above "profile.php?username=$1" or doing some other dynamic stuff with it?
     
    wvccboy, Sep 19, 2009 IP
  4. Oli3L

    Oli3L Active Member

    Messages:
    207
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    70
    #4
    What do you mean?
     
    Oli3L, Sep 19, 2009 IP