This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Basic Regexp
Author
Message |
bentos
Newbie


Joined: 15 October 2005
Posts: 15
Posted: 23 September 2011 at 4:38am

Hi All,

I would like to match requests to URLs of these types (i.e. beginning with /WebResource.axd? or /Telerik.Web.UI.WebResource.axd?)

i.e.

<script src="/WebResource.axd?d=arnJpb921fVnDDnbppY2yN1YBCoWuEQIe52mfvtVFG1zNI81uKr-M688mwIV0KI1eiTMGfPuCRQrnyvZ_70GOmAdl8A1&t=634316363525268834" type="text/javascript"></script>

<script src="/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-GB%3afab31106-1bd6-4491-9a14-59e0fc4a7081%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-GB%3abd09f19b-b595-4ea4-8ab8-449a745bc83c%3a16e4e7cd%3af7645509%3a22a6274a%3a24ee1bba%3af46195d3%3a874f8ea2%3a19620875%3a39040b5c%3af85f9819%3a490a9d4e%3abd8f85e4" type="text/javascript"></script>

I have tried the following rule but it does not seem to match requests and get the correct $1 for WebResource.axd(.*) -

RewriteCond %{HTTP:Host} ^mysub.domain\.co\.uk$
RewriteRule ^/WebResource.axd(.*) /WebResource.axd$1 [NC,NE,L]

[EDIT: I have been testing this in regextest and the ? in the test string seems to be stopping the (.*) from matching somehow? as per this http://tinypic.com/view.php?pic=1hezyv&s=7]

Thanks in advance


Edited by bentos - 23 September 2011 at 7:39am
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 26 September 2011 at 9:32am

Hello,

Please, try using the following:


RewriteCond %{HTTP:Host} ^mysub.domain\.co\.uk$
RewriteRule WebResource\.axd$ /WebResource.axd [NC,QSA,NE,L]

Regards
Andrew
Back to Top
 
bentos
Newbie


Joined: 15 October 2005
Posts: 15
Posted: 26 September 2011 at 11:03am

Hi Andrew,

Thanks very much for this, I think this has covered the

"/WebResource.axd?d=arnJpb921fVnDDnbppY2yN1YBCoWuEQIe52mfvtVFG1zNI81uKr ... case

as it seems to be catching it on the site for the subdomain, yet the url

/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-GB%3afab31106-1bd6-4491-9a14-59e0fc4a7081%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-GB%3abd09f19b-b595-4ea4-8ab8-449a745bc83c%3a16e4e7cd%3af7645509%3a22a6274a%3a24ee1bba%3af46195d3%3a874f8ea2%3a19620875%3a39040b5c%3af85f9819%3a490a9d4e%3abd8f85e4

does not seem to be catching, I have also tried adding this

RewriteCond %{HTTP:Host} ^mysub.domain\.co\.uk$
RewriteRule Telerik\.Web\.UI\.WebResource\.axd$ /Telerik.Web.UI.WebResource.axd [NC,QSA,NE,L]

to no avail.

Thanks again for your help

Matt

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 27 September 2011 at 3:50am

I think you need two of those, that would look like:


Code:
RewriteCond %{HTTP:Host} ^mysub\.domain\.co\.uk$
RewriteRule ^WebResource\.axd$ /WebResource.axd [NC,QSA,NE,L]

RewriteCond %{HTTP:Host} ^mysub\.domain\.co\.uk$
RewriteRule ^Telerik\.Web\.UI\.WebResource\.axd$ /Telerik.Web.UI.WebResource.axd [NC,QSA,NE,L]


Regards
Andrew
Back to Top
 
bentos
Newbie


Joined: 15 October 2005
Posts: 15
Posted: 28 September 2011 at 5:40am

Thanks Andrew

I can see that this SHOULD work, but a later catchall rule of mine which redirects any unmatched subdomain rules is still firing for this (as an example) -

http://mysub.domain.co.uk/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-GB%3afab31106-1bd6-4491-9a14-59e0fc4a7081%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-GB%3abd09f19b-b595-4ea4-8ab8-449a745bc83c%3a16e4e7cd%3af7645509%3a22a6274a%3a24ee1bba%3af46195d3%3a874f8ea2%3a19620875%3a39040b5c%3af85f9819%3a490a9d4e%3abd8f85e4

Is there any reason this could be missing the match due to all the encoded characters in querystring? (stumped)

As this is important I am willing to pay for support to get this and any related issues resolved.

Many Thanks,
Matt
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 29 September 2011 at 4:25am

To understand the nature of the request processing we'd need to see the rewrite.log for the testing request.
You find about enabling logging in FAQ

You may also try to use [NS] flag in the rule. This flag is like a full-stop command. No other sub-request will be processed after this rule is matched.

Regards
Andrew
Back to Top
 
bentos
Newbie


Joined: 15 October 2005
Posts: 15
Posted: 04 October 2011 at 10:17am

Thanks Andrew,

Looking at logging now will get back to you.

Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version