Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x support forum
 Helicon Tech : ISAPI_Rewrite 2.x support forum
Subject Topic: Convert Querystring Parameter 2 Directory Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
David Mukaiwa
Newbie
Newbie


Joined: 19 September 2008
Location: South Africa
Online Status: Offline
Posts: 4
Posted: 08 October 2008 at 3:41am | IP Logged Quote David Mukaiwa

< http-equiv="Content-" content="text/; charset=utf-8">< name="ProgId" content="Word.">< name="Generator" content="Microsoft Word 12">< name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CDAVID%7E1.MUK%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" target="_blank"><link rel="themeData" href="file:///C:%5CDOCUME%7E1%5CDAVID%7E1.MUK%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" target="_blank"><link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5CDAVID%7E1.MUK%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" target="_blank">< style>

I am trying to write a set of rules that will allow to rewrite a domain name and when the request points to a specific folder, I want to extract the value of a specific querystring parameter, transforming it into a folder.

Here is a set of pseudo-rules that I want to rewrite as regular expressions.

Conventions used in the pseudo-ruleset:

$Variable name
Text to be captured
Text to be dropped
Captured or injected text


Although it may be possible to implement this using fewer but more complex rules, it’ll be easier to maintain if I implemented it as modular solution comprised of 4 separate rules as follows:

1.      Request URL starts with “http://oldDomain.com/specialFolder$restofURL
Rewrite URL as “http://newDomain.com/specialFolder$restofURL”.
Continue processing

2.      Request URL starts with “http://newDomain.com/specialFolder?sprmName=$prmValue&$restOfQuerystring”,
Rewrite URL as “http://newDomain.com/specialFolder/$prmValue?$restofQuerystring
Stop processing

3.      Request URL is in the format “http://newDomain.com/specialFolder?$querystringFragment1&prmName=$prmValue&$restofURL
Rewrite URL as “http://newDomain.com/specialFolder/$prmValue?$querystringFragment1&$restofURL
Stop processing

I would appreciate your help with this. I hope this makes sense.

Thanks,

David

Back to Top View David Mukaiwa's Profile Search for other posts by David Mukaiwa Visit David Mukaiwa's Homepage
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7559
Posted: 08 October 2008 at 2:57pm | IP Logged Quote Lexey

1) You can not rewrite domain. You could only redirect or proxy and redirect or proxy rule is always the final one (no further processing is possible).

2)
RewriteCond Host: newDomain\.com
RewriteRule /specialFolder\?sprmName=([^&]*)(?:&(.*))? /specialFolder/$1?2\?$2: [I,L]

3)
RewriteCond Host: newDomain\.com
RewriteRule /specialFolder\?(.*)&prmName=([^&]*)(?:&(.*))? /specialFolder/$2\?$1?3&$3: [I,L]
Back to Top View Lexey's Profile Search for other posts by Lexey
 

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