How to rewrite this simple URL

Discussion in 'Apache' started by GRex, Oct 4, 2006.

  1. #1
    Hi, this is a seemingly easy rewrite task, but I just couldn't get it together after so long.

    What I need is kinda similar to del.icio.us, where I wanna turn:

    http://onelurv.com/bookmarks.php/demo to http://onelurv.com/demo

    This is my existing .htaccess:

    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^onelurv\.com$
    RewriteRule ^(.*)$ http://onelurv.com/$1 [L,R=301]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]+)/?(.*) $1.php/$2 [L]


    How do I get this going?
     
    GRex, Oct 4, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^.]+)$ bookmarks.php/$1 [L]
     
    Nintendo, Oct 4, 2006 IP
  3. GRex

    GRex Well-Known Member

    Messages:
    59
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    113
    #3
    Well it looks simple enough. I tried and what I get from http://onelurv.com/demo is

    No input file specified.

    This is my updated .htaccess:

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^onelurv\.com$
    RewriteRule ^(.*)$ http://onelurv.com/$1 [L,R=301]
    RewriteRule ^([^.]+)$ bookmarks.php/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]+)/?(.*) $1.php/$2 [L]

    What am I doing wrong?
     
    GRex, Oct 6, 2006 IP
  4. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #4
    php/$1

    probably need to be

    php?whatever=$1
     
    Nintendo, Oct 6, 2006 IP
  5. GRex

    GRex Well-Known Member

    Messages:
    59
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    113
    #5
    Ok, I have to revamp lotsa code to make that work. I'm sure some bug will come up coz of that. But it worked nonetheless, so thank Nintendo.
     
    GRex, Oct 9, 2006 IP