| Posted: 17 July 2008 at 3:18pm | IP Logged
|
|
|
Hallow,
How do you set defualt values in the result string when the value wont exist. In my test string it takes the forms as follows.
/productid-01-02-03-04/page-17.htm, IS ses/test.htm?p=17&CAT1=01&C2=02&C3=03&C4=04
/productid-01-02-03-/page-17.htm, SHould BE = ses/test.htm?p=17&CAT1=01&C2=02&C3=03&C4=0
/productid-01-02-/page-17.htm, should be ses/test.htm?p=17&CAT1=01&C2=02&C3=0&C4=0
/productid-01-/page-17.htm, and ses/test.htm?p=17&CAT1=01&C2=0&C3=0&C4=0
Ide like it to set defualt values even thougt the others arnt present in the string but will be present in the result string.
So if the other blues values arnt ther then the red zeros will be added to the result, hopefully using only rule.
Code:
| RewriteRule ^/.*productid-([0-9]+)(?:-*([0-9]+)?(?:-*([0-9]+))?(?:-*([0-9]+))?)-*\/.*page-([0-9]+)*\.htm$ /ses/test.htm?PAGE=$5&N1=$2?3&N2=$3:N2?4&N3=$4:&N3=NoValue |
|
|
this rule will chop off the remaining name values up to the the existing value
Code:
RewriteRule ^/.*productid-([0-9]+)(?:-*([0-9]+)?(?:-*([0-9]+))?(?:-*([0-9]+))?)-*\/.*page-([0-9]+)*\.htm$ /ses/test.htm?p=$5&CAT1=$1&C2=$2?3&C3=$3&C4=$4
|
|
|
Regards,
Edited by tilly - 17 July 2008 at 3:34pm
|