URL rewrite

Discussion in 'Programming' started by MrLeN, Mar 28, 2011.

  1. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    It really depends... would this be used, like to show profiles here on DP ? if so maybe something like this should work, but bare in-mind, this might cause problems to other rules, but not file names.

    
    
    Options +FollowSymLinks
    
    RewriteEngine on
    
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteCond %{REQUEST_FILENAME} !-f
    
    RewriteRule (.[^/]*) /member.php?user=$1 [NC,L]
    
    
    Code (markup):
     
    MyVodaFone, Mar 28, 2011 IP
  2. MrLeN

    MrLeN Well-Known Member

    Messages:
    406
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    120
    #3
    MrLeN, Mar 28, 2011 IP
  3. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #4
    Its to tell the server that the username is not a file or directory name, anyway whats the current url your users goto ?
     
    MyVodaFone, Mar 28, 2011 IP
  4. MrLeN

    MrLeN Well-Known Member

    Messages:
    406
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    120
    #5
    MrLeN, Mar 28, 2011 IP
  5. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #6
    and if you try this what happens ?

    
    Options +FollowSymLinks
    
    RewriteEngine on
    
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteCond %{REQUEST_FILENAME} !-f
    
    RewriteRule (.[^/]*) /index.php?user=$1 [NC,L]
    
    
    Code (markup):
    http://www.mywebsite.com/username
     
    MyVodaFone, Mar 28, 2011 IP
  6. MrLeN

    MrLeN Well-Known Member

    Messages:
    406
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    120
    #7
    Firefox says: "Oops! This link appears to be broken."
     
    MrLeN, Mar 28, 2011 IP
  7. vegabond

    vegabond Shabu Anower

    Messages:
    1,656
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    240
    #8
    vegabond, Apr 2, 2011 IP