Order of processing IIS7 ISAPI_Rewrite 3.0
7 posts
• Page 1 of 1
Order of processing IIS7 ISAPI_Rewrite 3.0
Hi,
I have a weird problem with what looks like a simple rule.
The web site is served from a folder called "website"
There is a virtual directory called "amot-search" pointed to the same root folder, and it contains a default.asp file.
What I'm trying to achieve is to create a "default document" for this VDir, using a rewrite rule (as IIS7 seemingly won't allow you to have a default document with a query string, unlike IIS6).
httpd.conf contains a <VirtualHost> directive enabling the site.
#Amot
<VirtualHost www.armymuseums.co.uk>
The .htaccess file for the site contains:
RewriteRule ^amot-search/$ amot-search/default.asp?Category=Amot&Service=Museum-Search [LC,NS,L]
Calling this as www.armymuseums.co.uk/amot-search/ gets a 404.
However, there's nothing in the rewrite log - so it looks as though this process hasn't reached ISAPI-Rewrite.
If I call the target URL explicitly:
www.armymuseums.co.uk/amot-search/defau ... eum-Search
then:
1) The page renders as desired and
2) There is a log entry in the rewrite log processing the request (but not rewriting it as no rules are in force).
If I change the rewrite rule to:
RewriteRule ^amot-search$ amot-search/default.asp?Category=Amot&Service=Museum-Search [LC,NS,L]
- and submit the URL *without* the trailing slash,
www.armymuseums.co.uk/amot-search
- then it works.
So, to my eye, this looks like a permissions issue, which is why I'm asking:
1) What is the order in which things are processed when a URL is submitted? It looks like the 404 is generated without the filter being activated, because it causes no logging?
2) If it *is* permissions, what permissions am I likely to need to make this work properly?
This is particularly puzzling, as I have another site on the same machine that works just fine with this approach- I'm clearly missing something, but I can't figure out what.
I have a weird problem with what looks like a simple rule.
The web site is served from a folder called "website"
There is a virtual directory called "amot-search" pointed to the same root folder, and it contains a default.asp file.
What I'm trying to achieve is to create a "default document" for this VDir, using a rewrite rule (as IIS7 seemingly won't allow you to have a default document with a query string, unlike IIS6).
httpd.conf contains a <VirtualHost> directive enabling the site.
#Amot
<VirtualHost www.armymuseums.co.uk>
The .htaccess file for the site contains:
RewriteRule ^amot-search/$ amot-search/default.asp?Category=Amot&Service=Museum-Search [LC,NS,L]
Calling this as www.armymuseums.co.uk/amot-search/ gets a 404.
However, there's nothing in the rewrite log - so it looks as though this process hasn't reached ISAPI-Rewrite.
If I call the target URL explicitly:
www.armymuseums.co.uk/amot-search/defau ... eum-Search
then:
1) The page renders as desired and
2) There is a log entry in the rewrite log processing the request (but not rewriting it as no rules are in force).
If I change the rewrite rule to:
RewriteRule ^amot-search$ amot-search/default.asp?Category=Amot&Service=Museum-Search [LC,NS,L]
- and submit the URL *without* the trailing slash,
www.armymuseums.co.uk/amot-search
- then it works.
So, to my eye, this looks like a permissions issue, which is why I'm asking:
1) What is the order in which things are processed when a URL is submitted? It looks like the 404 is generated without the filter being activated, because it causes no logging?
2) If it *is* permissions, what permissions am I likely to need to make this work properly?
This is particularly puzzling, as I have another site on the same machine that works just fine with this approach- I'm clearly missing something, but I can't figure out what.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Order of processing IIS7 ISAPI_Rewrite 3.0
Hello,
First, ISAPI_Rewrite treats virtual folders just like any other folder.
1) all our secrets are described here:
- http://www.helicontech.com/articles/exp ... te-part-i/
- http://www.helicontech.com/articles/exp ... te-part-2/
2) i'm not sure it's permissions. If it is, than in error.log you'd have a corresponding entry.
Could there be another rule that deals with trailing slashes?
You can also try:
which makes a slash at the end optional.
Regards
Andrew
First, ISAPI_Rewrite treats virtual folders just like any other folder.
1) all our secrets are described here:
- http://www.helicontech.com/articles/exp ... te-part-i/
- http://www.helicontech.com/articles/exp ... te-part-2/
2) i'm not sure it's permissions. If it is, than in error.log you'd have a corresponding entry.
Could there be another rule that deals with trailing slashes?
You can also try:
- Code: Select all
RewriteRule ^amot-search/?$ amot-search/default.asp?Category=Amot&Service=Museum-Search [LC,NS,L]
which makes a slash at the end optional.
Regards
Andrew
Re: Order of processing IIS7 ISAPI_Rewrite 3.0
That change makes no difference.
It still works without the slash, but not with it (which is particularly problematic with some browsers, which seem to want to add the / for you).
The thing is, we have logging switched on, at debug level.
When you submit it without the slash, the log contains all the processing. When you submit it *without* the slash, there is *nothing* in the log- there's no sign of that URL being submitted to ISAPI_rewrite for consideration. Which is why I'm wondering about permissions: could IIS be deciding that it's not going to permit the directory to be listed *before* applying ISAPI filters?
It still works without the slash, but not with it (which is particularly problematic with some browsers, which seem to want to add the / for you).
The thing is, we have logging switched on, at debug level.
When you submit it without the slash, the log contains all the processing. When you submit it *without* the slash, there is *nothing* in the log- there's no sign of that URL being submitted to ISAPI_rewrite for consideration. Which is why I'm wondering about permissions: could IIS be deciding that it's not going to permit the directory to be listed *before* applying ISAPI filters?
Re: Order of processing IIS7 ISAPI_Rewrite 3.0
Hmmm.
Now I'm seeing:
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (2) init rewrite engine with requested uri /amot-search/
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (1) Htaccess process request
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (1) Htaccess process request e:\web sites\amot\web site\.htaccess
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (3) applying pattern '^amot-admin/?$' to uri ''
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (3) applying pattern '^amot-search/?$' to uri ''
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (3) applying pattern '^amot-user/?$' to uri ''
Which I wasn't seeing before: but it's not seemingly triggering?
I'm assuming that the logging is written out in blocks- it's sometimes quite a delay from submitting a URL to seeing anything in the log?
Now I'm seeing:
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (2) init rewrite engine with requested uri /amot-search/
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (1) Htaccess process request
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (1) Htaccess process request e:\web sites\amot\web site\.htaccess
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (3) applying pattern '^amot-admin/?$' to uri ''
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (3) applying pattern '^amot-search/?$' to uri ''
16:26:31 GMT [www.armymuseums.co.uk/sid#16][rid#18883560/initial] (3) applying pattern '^amot-user/?$' to uri ''
Which I wasn't seeing before: but it's not seemingly triggering?
I'm assuming that the logging is written out in blocks- it's sometimes quite a delay from submitting a URL to seeing anything in the log?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Order of processing IIS7 ISAPI_Rewrite 3.0
That's strange!!! Very!
first it says
then
It's the same request, but further in the processing it looks like the request is blank(as if you're requesting the root). Are you sure there's nothing else that takes place here?
Give me more info... IIS version, CMS?, PLESK?, ColdFusion?, RewriteBase directive?
This shoudln't be happening.
Regards
ANdrew
first it says
- Code: Select all
(2) init rewrite engine with requested uri /amot-search/
then
- Code: Select all
(3) applying pattern '^amot-admin/?$' to uri ''
It's the same request, but further in the processing it looks like the request is blank(as if you're requesting the root). Are you sure there's nothing else that takes place here?
Give me more info... IIS version, CMS?, PLESK?, ColdFusion?, RewriteBase directive?
This shoudln't be happening.
Regards
ANdrew
Re: Order of processing IIS7 ISAPI_Rewrite 3.0
I'm seeing:
init rewrite engine with requested uri /amot-search
Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Htaccess process request
Htaccess process request e:\web sites\amot\web site\.htaccess
applying pattern '^amot-admin/?$' to uri 'amot-search'
applying pattern '^amot-search/?$' to uri 'amot-search'
Rewrite URL to >> /amot-search/default.asp?Category=Amot&Service=Museum-Search
rewrite 'amot-search' -> '/amot-search/default.asp?Category=Amot&Service=Museum-Search'
internal redirect with /amot-search/default.asp?Category=Amot&Service=Museum-Search [INTERNAL REDIRECT]
- which is fine.
And then:
init rewrite engine with requested uri /amot-search/
Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Htaccess process request
Htaccess process request e:\web sites\amot\web site\.htaccess
applying pattern '^amot-admin/?$' to uri ''
applying pattern '^amot-search/?$' to uri ''
applying pattern '^amot-user/?$' to uri ''
So, as you say, it's somehow misapplying the uri.
IIS version is 7
No CMS, Plesk, ColdFusion etc etc- it's a dedicated server, not a slice of shared hosting (it *is* shared hosting, but my client is the server owner).
The platform is called CoolICE, and it uses classic ASP, hence all the "default.asp" stuff.
*AH*!
I think I found it: there's no "RewriteBase" directive.
Let me add it in.....
Aha!
Adding "RewriteBase /" makes it all spring into life!
init rewrite engine with requested uri /amot-search
Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Htaccess process request
Htaccess process request e:\web sites\amot\web site\.htaccess
applying pattern '^amot-admin/?$' to uri 'amot-search'
applying pattern '^amot-search/?$' to uri 'amot-search'
Rewrite URL to >> /amot-search/default.asp?Category=Amot&Service=Museum-Search
rewrite 'amot-search' -> '/amot-search/default.asp?Category=Amot&Service=Museum-Search'
internal redirect with /amot-search/default.asp?Category=Amot&Service=Museum-Search [INTERNAL REDIRECT]
- which is fine.
And then:
init rewrite engine with requested uri /amot-search/
Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
Htaccess process request
Htaccess process request e:\web sites\amot\web site\.htaccess
applying pattern '^amot-admin/?$' to uri ''
applying pattern '^amot-search/?$' to uri ''
applying pattern '^amot-user/?$' to uri ''
So, as you say, it's somehow misapplying the uri.
IIS version is 7
No CMS, Plesk, ColdFusion etc etc- it's a dedicated server, not a slice of shared hosting (it *is* shared hosting, but my client is the server owner).
The platform is called CoolICE, and it uses classic ASP, hence all the "default.asp" stuff.
*AH*!
I think I found it: there's no "RewriteBase" directive.
Let me add it in.....
Aha!
Adding "RewriteBase /" makes it all spring into life!
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Order of processing IIS7 ISAPI_Rewrite 3.0
Wait! it fixed it? I'm suprised....
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 24 guests