Simple RewriteRule Problem

Discussion in 'PHP' started by SGBoise, Nov 10, 2008.

  1. #1
    Hi Guys,

    I hope someone can help me with this. I am trying to match this url.

    /videos/nice-video-.html
    Code (markup):
    Right now I have this

    RewriteRule ^videos/([_A-Za-z0-9-]+)/?$ tms_redirect.php?mediaurl=$1 [NC,L]
    Code (markup):
    This will match this url
    /videos/nice-video.html
    Code (markup):
    But I need it to match with the - between video and .html. I tried several variations but I can get it to work.

    Thanks in advance.
     
    SGBoise, Nov 10, 2008 IP
  2. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #2
    Rewrite rule you provided will not match both of these urls, because it doesn't allow the dot sign and could match only directories without (.html) part. It seems you have another line in your .htaccess for .html handling.
     
    wmtips, Nov 10, 2008 IP
  3. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #3
    Maby try this:

    [a-zA-Z0-9\-] and add the .html


    RewriteRule ^videos/([_A-Za-z0-9\-]+).html/?$ tms_redirect.php?mediaurl=$1 [NC,L]
     
    EricBruggema, Nov 10, 2008 IP
  4. SGBoise

    SGBoise Peon

    Messages:
    647
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    SGBoise, Nov 10, 2008 IP