Rewriterule help

Discussion in 'PHP' started by myinnet, Jun 20, 2008.

  1. #1
    I have a url like:
    http://www.mydomain.com/nature_scene-3.html

    i need it to redirect to http://www.mydomain.com/show.php?id=$1

    i do not care about the nature_scene, just the 3 is the key. i have a rewriterule like:
    RewriteRule [*]_([0-9]+).html show.php?id=$1
    but it not works. can anyone help?
     
    myinnet, Jun 20, 2008 IP
  2. dev_SeeInside

    dev_SeeInside Peon

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    sorry, this is just off the top of my head, but this should work:

    RewriteRule ^(.*)([0-9]+).html show.php?id=$2
     
    dev_SeeInside, Jun 20, 2008 IP
  3. Pradipta saha

    Pradipta saha Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if you want to redirect to a page,then you use header("location:pop.php");
    <?php
    $i=1;
    header("location:show.php?id=".$i);
    ?>
     
    Pradipta saha, Jun 20, 2008 IP
  4. myinnet

    myinnet Peon

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I just get it works,
    RewriteRule [0-9a-zA-Z_]-([0-9]+).html show.php?id=$1
     
    myinnet, Jun 21, 2008 IP