url problems

Topics: Developer Forum, Project Management Forum, User Forum
Oct 24, 2008 at 4:40 PM
i am still having problems understanding how this works i have the filter running on my server but i think i cannot grasp the rules

RewriteRule ^/state/([^/]+) /city.asp?state=$1

basically i want the url to be like /state/virginia/

but not working, plz help. ty
Coordinator
Oct 24, 2008 at 4:47 PM
Try the testdriver.exe program in the download.  (read about it in the readme)
The TestDriver.exe is really helpful for understanding how the rules work.
Oct 24, 2008 at 6:07 PM
i found the exe but no readme about it.
Coordinator
Oct 25, 2008 at 3:24 AM

Here is the content from the readme on TestDriver.exe  (I just updated it with some additional info).

Testing
---------------------------------

You can test your sets of rules against sample URLs by using the
included TestDriver program.  Source for that is also included.   The
TestDriver links with the ISAPI filter, and asks it to apply the
Rewrite rules to a given set of sample URLs.  The sample Urls
are obtained from SampleUrls.txt, and the rewrite rules are
obtained from the ini file, as normal.  (Again, the ini file name
should be IsapiRewrite4.ini ). 

SampleUrls.txt should have one or more lines, each containing an
incoming URL and an expected result.  The # character as the first
character in the line indicates a comment. For example:

# Incoming URL                                       Expected Result
#---------------------------------------------------------------------- 
#
/product/family9.html                               /index.asp
/index.jsp                                          /index.asp
/Components.php                                     /index.asp
/search?q=findthis                                  /index.asp?q=findthis
/query.htm?s=Foo                                    /index.asp?s=Foo


/do_nothing/family9.html                            /do_nothing/family9.html

The first non-comment line in the ini file above says, for an incoming URL of
'/product/family9.html'  the rewrite result is expected to be '/index.asp'.

The second parameter on each line specifes the expected result.  It may
be a URL, or one of the following:

     NO REWRITE
     FORBIDDEN
     REDIRECT <code>  <URL>
     NOT FOUND

The TestDriver program accepts a -d switch, which tells it where to load
the ini and SampleUrls.txt file.

When you run the TestDriver.exe, the ISAPI reads the ini file in the
specified directory, as normal to determine the Logging level
(0,1,2,3...) and the various rules to use.  But, the logfile setting is
overridden - all logging info is sent to stdout, the console. The
LogLevel in the ini file is used, so if you specify a LogLevel of zero,
you will see no output from TestDriver.exe, which is probably not what
you want.

The TestDriver then sends each one of the sample URLs into the filter,
and then compares the output with your expected result.  The TestDriver
produces a message line for each URL processed, and a summary report for
the full run.  In this way you can test a set of URLs against a set of
rules.  It's very easy to see if your rules are doing what you expect
them to do. 

Take care in designing the set of sample URLs.  Be sure to specify edge
cases and "illegal" URLs - to make sure that your rewrite rules
gracefully handle URLs that are outside the expected format. 

Using the -d switch, you can use different directories to store multiple
independent ini files and url sample sets.  Within the <tests> directory
in the source distribution zipfile, there are several subdirectories
which illustrate the point.  Example:

load the ini file and test the SampleUrls.txt in dir
"tests\CaseInsensitive" :

   testdriver -d tests\CaseInsensitive

Please note: the TestDriver.exe program does not run within the context
of an HTTP server, and so does not work with HTTP Server variables.  In
particular, if you use RewriteCond in the ini files that you test with
TestDriver.exe, and those RewriteCond statements reference Server
variables (eg %{HTTP_URL}) , those RewriteCond statements will not
behave in the TestDriver the same way they will behave in an ISAPI. Such
conditions will not work.

Likewise, if you reference server variables in the replacement pattern,
it won't work the way you might hope.  In general, it is difficult to
use TestDriver to evaluate any ruleset that relies on HTTP Server
variables. For that you need an actual web client test program, and an
actual IIS with IIRF installed.

 

Oct 25, 2008 at 9:20 PM
when i load that it says the precidure evaluation link could not be loaded in they dynamic link library, not sure what that means but this insnt installin easily , thanks for your help so far hopefully we can find a solution for me.
Coordinator
Oct 26, 2008 at 12:03 AM
and this is in the DLL that you have compiled? the 64-bit version?

From: [email removed]
Sent: Saturday, October 25, 2008 1:20 PM
To: [email removed]
Subject: Re: url problems [IIRF:38436]

From: acidx0

when i load that it says the precidure evaluation link could not be loaded in they dynamic link library, not sure what that means but this insnt installin easily , thanks for your help so far hopefully we can find a solution for me.