.htaccess multiple variable rewrite

Discussion in 'Programming' started by fgs, Apr 16, 2008.

  1. #1
    Hey DP'ers,

    would love to get some help from you one more time, please

    currently I am using
    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule page(.*)\.html$ /page.php?id=$1
    
    PHP:
    but am looking to pass 2 to 3 variables for instance to convert
    page.php?id=10&type=20&dp=43
    into page10type20dp43.html

    Thanks a lot for taking the time to read this and help :D
     
    fgs, Apr 16, 2008 IP
  2. Randombase

    Randombase Peon

    Messages:
    224
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need to narrow down the regex you are using to find the variable, I think this code should work
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule page([0-9])type([0-9])dp([0-9])\.html$ /page.php?id=$1&type=$2&dp=$3
    Code (markup):
     
    Randombase, Apr 16, 2008 IP
    fgs likes this.
  3. fgs

    fgs Peon

    Messages:
    967
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    0
    #3
    RandomBase, thanks so much, that works to perfection... and actually helped me grasp the concept of rewrite so much better that i'm going to town with this :-P

    THANK YOU!!!!

    i knew i could count on DPers :p
     
    fgs, Apr 17, 2008 IP