.htaccess url rewrite

Discussion in 'PHP' started by manivannang, Jun 27, 2011.

  1. #1
    hi

    I wanted to do url rewrite on my website

    I want to change the following url

    www.test.com/folder1/red.php?name=file1&ext=mp4
    into
    www.test.com/folder1/file1.mp4

    Can you tell me what code should i enter in .htaccess

    thanks in advance
     
    manivannang, Jun 27, 2011 IP
  2. ntomsheck

    ntomsheck Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteRule /folder1/([^/\.])\.([^/\.]) /folder1/red.php?name=$1&ext=$2 [L]

    This will of course allow special characters, so tighten the two regex statements to only allow the characters you need.
     
    ntomsheck, Jun 27, 2011 IP
  3. manivannang

    manivannang Peon

    Messages:
    117
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Not Found

    The requested URL /folder1/video.mp4 was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
     
    manivannang, Jun 27, 2011 IP
  4. ntomsheck

    ntomsheck Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Turn on redirect logging and see where it's actually trying to go. I don't know how to off the top of my head, but google will tell you.
     
    ntomsheck, Jun 27, 2011 IP
  5. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0