Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0 support forum
 Helicon Tech : ISAPI_Rewrite 3.0 support forum
Subject Topic: Set defualt values Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
tilly
Groupie
Groupie


Joined: 24 June 2008
Location: Neutral Zone
Online Status: Offline
Posts: 49
Posted: 17 July 2008 at 3:18pm | IP Logged Quote tilly

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
Back to Top View tilly's Profile Search for other posts by tilly
 
Vyacheslav
Moderator Group
Moderator Group


Joined: 02 July 2008
Location: Ukraine
Online Status: Offline
Posts: 578
Posted: 18 July 2008 at 5:39am | IP Logged Quote Vyacheslav

Hi Will.

Please try the following solution:
Code:
RewriteRule ^productid-(\d+)(?:-(\d+))?(?:-(\d+))?(?:-(\d+))?/page-(\d+)\.htm$ ses/test.htm?p=$5&CAT1=$1&C2=(?2$2:0)&C3=(?3$3:0)&C4=(?4$4:0)


__________________
Kind regards!
Vyacheslav Shinkarenko, HeliconTech.
Back to Top View Vyacheslav's Profile Search for other posts by Vyacheslav Visit Vyacheslav's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum