ModRewite Multiple Variables

Discussion in 'Site & Server Administration' started by MikeLiao, Oct 12, 2008.

  1. #1
    I need to ModRewrite this

    index.php?v=$1&s=$2&p=$3&c=$4

    I know this one would do
    RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/page([^/\.]+)/([A-Za-z0-9-]+)/?.html$ index.php?v=$1&s=$2&p=$3&c=$4 [N]
    (www.example.com/view/show/page1/category.html)


    But by problem is the variables v, s, p and c are NOT REQUIRED to be always present. So using the mod rewite above will treat the following
    www.example.com/show as www.example.com/index.php?v=$1 while it should be www.example.com/index.php?s=$1

    OR

    www.example.com/page1/category.html as www.example.com/index.php?v=$1&s=$2 while it should be www.example.com/index.php?p=$1&c=$2

    How can I resolve this? Thanks
     
    MikeLiao, Oct 12, 2008 IP
  2. crivion

    crivion Guest

    Best Answers:
    0
    #2
    xem247.com has a nice rewrite tool
     
    crivion, Oct 12, 2008 IP
  3. MikeLiao

    MikeLiao Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Anyone? crivion post is just a spam
     
    MikeLiao, Oct 13, 2008 IP