Rewriting not applied

Topics: User Forum
Aug 26, 2011 at 10:45 AM

Hello there.

I've just installed iirf without any problem on one of the websites on my server.

so there is vdir. i'm using iirf 2.1

well, i'm trying to encode a part of the url (because recreate false url in the pagecode is too complicated) :

RewriteRule ^/Assemblees/AfficheDoc.aspx?&doc=(.*)&ripid=(.*)$ ^/Assemblees/AfficheDoc.aspx?&doc=#X$1#E&ripid=$2

even in the state bar and the url field i see the entire url with the parameter i would like to crypt.

 

in the log file i get : Fri Aug 26 11:40:23 -  1720 - ReadVdirConfig: Done reading INI for the root vdir, found 1 rules (0 errors, 0 warnings) on 20 lines, in 1 modules

so it seam all is ok.

 

I really don't understand. Even i use : RewriteRule ^/Assemblees/AfficheDoc.aspx?&doc=(.*)&ripid=(.*)$ www.google.com

there is no action.

i must tell you the url is dynamically created in the codebehind of the website.

Coordinator
Aug 26, 2011 at 8:45 PM
Edited Aug 26, 2011 at 8:49 PM

? is a meaningful character in the regex language.  It does not match ?.  It implies "zero or more of the previous atom".  In your case, the previous atom is x.  Also, the dot is a meaningful character.  It matches any character. 

An example: The regex pattern .... blahblah.aspx?   matches   blahblah.asp    as well as blahblah.aspx  and blahblahXasp .

The regex pattern .... blahblah.aspx?&foo matches blahblah.asp&foo as well as blahblah.aspx&foo and blahblah0aspx&foo.

Looking at your pattern, it's probably not what you wanted.

By the way, The IIRF documentation is just CHOCK FULL of little bits of information like this, information that will make your use of IIRF much more pleasant for you. I recommend that you Check it out!

A good way to determine if your regexes are doing what you want is to use visual a regex testing tool. 

There are many free tools available. One is available here: http://cheeso.members.winisp.net/srcview.aspx?file=WinForms-RegexTester.zip

The recommendation to use a visual test tool is another thing that is in the IIRF documentation.

Finally, I know of no URLs that include a sequence like this:  Page.aspx?&var=7  .  Normally the ampersand separates distinct query params, and the ampersand does not appear as the first character after the question mark.  I think you've got something a little confused there.  Re-visit that.

Good luck!

Aug 29, 2011 at 4:24 PM
Edited Aug 29, 2011 at 4:31 PM

you mean: Page.aspx?var=7 instead of: Page.aspx?&var=7   ?

Must i use: Page.aspx\?&var=7  ?

Anyway, there is nothing more... And i study the doc for several days.

Coordinator
Aug 31, 2011 at 3:43 AM

YEs, you must precede ? with a backslash, if you want it to actually match ?. 

I suggest you try a regex  tester to get familiar with the concepts.

Also - I  mean to say that the sequence ?& is almost never found in a URL . Normally it is Foo.aspx?key1=value1&key2=value2 .  Notice that the thing following the ? is a key name - actually the name of a querystring parameter.   NOT an ampersand.  The ampersand separates a querystring parameter value from the following querystring parameter name.

If your pattern is matching on Foo.aspx?&something, then either your URLs are broken, or your IIRF rules are broken.  

 

Aug 31, 2011 at 8:18 AM
Yes you're right.
However, the rule does not work anyway. I still see the entire url, never encrypted nor rewrited. I had to pass parameters in session variable.
I still study IIRF :)
Olivier Buisson
Responsable Informatique
PROXINVEST SA

Le 31/08/2011 04:43, Cheeso a écrit :

From: Cheeso

YEs, you must precede ? with a backslash, if you want it to actually match ?.

I suggest you try a regex tester to get familiar with the concepts.

Also - I mean to say that the sequence ?& is almost never found in a URL . Normally it is Foo.aspx?key1=value1&key2=value2 . Notice that the thing following the ? is a key name - actually the name of a querystring parameter. NOT an ampersand. The ampersand separates a querystring parameter value from the following querystring parameter name.

If your pattern is matching on Foo.aspx?&something, then either your URLs are broken, or your IIRF rules are broken.

Coordinator
Aug 31, 2011 at 5:15 PM

You can try the Regex Tester that I Recommended to gain familiarity with regex.

You can look in the IIRF log to gain some insight into how it is evaluating rules against the incoming requests.