Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Help with rules Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
SliNgSh0t
Newbie
Newbie


Joined: 22 June 2010
Online Status: Offline
Posts: 13
Posted: 24 June 2010 at 3:56pm | IP Logged Quote SliNgSh0t

Hi,

Ok I see in the documentation to access a physical URL like http://www.myhost.com/foo.asp?a=A&b=B&c=C and using a request like http://www.myhost.com/foo.asp~a~A~b~B~c~C I can use

[ISAPI_Rewrite]

RewriteRule (.*?\.asp)(\?[^~]*)?~([^~]*)~([^~]*)(.*) $1(?2$2&:\?)$3=$4$5 [NS,I]

but how do I write the first rule if I want user to click on http://www.myhost.com/foo.asp?a=A&b=B&c=C and redirect so that http://www.myhost.com/foo.asp~a~A~b~B~c~C is displayed in the address bar.  There can be any number of parameters.

Thanks

Back to Top View SliNgSh0t's Profile Search for other posts by SliNgSh0t
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10488
Posted: 25 June 2010 at 3:58am | IP Logged Quote Anton

The redirect rule will be:

RewriteRule (.*?\.asp[^?]*)\?([^=&]*)=([^=&]*)&?(.*) $1~$2~$3\?$4 [NS,I,RP]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
SliNgSh0t
Newbie
Newbie


Joined: 22 June 2010
Online Status: Offline
Posts: 13
Posted: 25 June 2010 at 12:50pm | IP Logged Quote SliNgSh0t

Anton,

I'm getting a trailing ?

So http://www.myhost.com/foo.asp?cat=SYS is showing up as http://www.myhost.com/foo.asp~cat~SYS?

RewriteRule (.*?\.asp[^?]*)\?([^=&]*)=([^=&]*)&?(.*) $1~$2~$3\?$4 [NS,I,R]
RewriteRule (.*?\.asp)(\?[^~]*)?~([^~]*)~([^~]*)(.*) $1(?2$2&:\?)$3=$4$5 [NS,I]

 

Back to Top View SliNgSh0t's Profile Search for other posts by SliNgSh0t
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10488
Posted: 29 June 2010 at 5:45am | IP Logged Quote Anton

Please try to fix the line like this:

RewriteRule (.*?\.asp[^?]*)\?([^=&]*)=([^=&]*)&?(.+)? $1~$2~$3(?4\?$4) [NS,I,R]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
SliNgSh0t
Newbie
Newbie


Joined: 22 June 2010
Online Status: Offline
Posts: 13
Posted: 29 June 2010 at 12:53pm | IP Logged Quote SliNgSh0t

Anton,

Thanks, that works great.  But how would these two rules change if I wanted to hard-code the page name into the rules, i.e, replacing the first expression (.*?\.asp[^?]*) with foo.asp?  I'm having trouble making it work.

Back to Top View SliNgSh0t's Profile Search for other posts by SliNgSh0t
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10488
Posted: 30 June 2010 at 3:32am | IP Logged Quote Anton

It should be like this:

RewriteRule (/foo\.asp[^?]*)\?([^=&]*)=([^=&]*)&?(.+)? $1~$2~$3(?4\?$4) [NS,I,R]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 

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