htaccess url rewrite question

Discussion in 'Apache' started by bluemouse2, Aug 12, 2006.

  1. #1
    Can you please help me rewrite this?

    domain.com/forum.php?id=1

    into

    domain.com/1



    update! I have the answer

    RewriteEngine On
    RewriteBase /
    RewriteRule (.*)/$ forum.php?id=$1
     
    bluemouse2, Aug 12, 2006 IP
  2. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #2
    I still have a question

    my example rewrites to domain.com/1/
    but I want domain.com/1 too

    any help?
     
    bluemouse2, Aug 12, 2006 IP
  3. Cryogenius

    Cryogenius Peon

    Messages:
    1,280
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Put a '?' after your '/' in your RewriteRule. Post your RewriteRule if you need more help.
     
    Cryogenius, Aug 12, 2006 IP
  4. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #4
    thanks.
    it doesn't work though...
     
    bluemouse2, Aug 12, 2006 IP
  5. smatts9

    smatts9 Active Member

    Messages:
    1,089
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    88
    #5
    For domain.com/forum.php?id=1 -> domain.com/1
    Use:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^([0-9]+)?$ /forum.php?id=$1 [L]
    </IfModule>
     
    smatts9, Aug 12, 2006 IP
  6. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #6
    Thanks!
    Problem is now solved :)
     
    bluemouse2, Aug 13, 2006 IP