Simple mod rewrite ,, Please help

Discussion in 'PHP' started by mab, Feb 21, 2008.

  1. #1
    mab, Feb 21, 2008 IP
  2. rossdalangin

    rossdalangin Well-Known Member

    Messages:
    458
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule user/(.*)/$ /user.php?u=$1
     
    rossdalangin, Feb 21, 2008 IP
  3. Sergey Ten

    Sergey Ten Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think you have to make the URL with slash in the end:

    
    http://www.site.com/user/someone/
    
    Code (markup):
    Then rule will be the following:

    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^user/(.*?)/$ /user.php?u=$1
    
    Code (markup):
     
    Sergey Ten, Feb 21, 2008 IP
  4. mab

    mab Active Member

    Messages:
    563
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    80
    #4
    thanks brothers ,, i didn't worked but i found a solution ..
    make a new folder and name it "user" then put the file and the htaccess

     
    mab, Feb 21, 2008 IP
  5. hooverweb

    hooverweb Member

    Messages:
    96
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    hooverweb, Feb 21, 2008 IP
  6. NathanH

    NathanH Peon

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Mab, I don't suggest you do it that way. Keep user.php in the main directory. In the .htaccess file, it should have the following rule:

    RewriteRule ^user/([^\/].*)/?$ user.php?u=$1 [L]
    Code (markup):
     
    NathanH, Feb 22, 2008 IP