Simple rule not being matched

Topics: Developer Forum, User Forum
Apr 3, 2010 at 11:28 PM

I'll admit regular expressions aren't my string point so I thought I'd try something simple.

RewriteRule ^/aboutus/news/([0-9]+)$ /aboutus/news/Pages/news.aspx?year=$1 [I]

I've tried this regular expression in a couple of online regualr expression checkers and it matches the supplied string /aboutus/news/2009 but in reality I get a 404 page. I'm running Server 2008 R2 and have the filter deployed at server level. My IirfGlobal file contains one line: RewriteEngine OFF and my iirf.ini file for the site i'm using this on contains;

RewriteEngine ON
RewriteLog  D:\temp\iirfLog.out
RewriteLogLevel 5
StatusUrl /iirfStatus

RewriteRule ^/aboutus/news/([0-9]+)$ /aboutus/news/Pages/news.aspx?year=$1 [I]

A log file is created and contains the following which seems to indicate that the rule isn't being matched but I can't figure out why.

Sat Apr 03 23:26:36 -  4660 - -------------------------------------------------------
Sat Apr 03 23:26:36 -  4660 - Ionic ISAPI Rewriting Filter (IIRF) 2.0.1.15 RELEASE
Sat Apr 03 23:26:36 -  4660 - IIRF was built on: Dec 16 2009 10:11:30
Sat Apr 03 23:26:36 -  4660 - Cached: DLL_PROCESS_ATTACH
Sat Apr 03 23:26:36 -  4660 - Cached: Process ID: 2184
Sat Apr 03 23:26:36 -  4660 - Cached: DLL_PROCESS_ATTACH - complete
Sat Apr 03 23:26:36 -  4660 - Cached: GetFilterVersion
Sat Apr 03 23:26:36 -  4660 - GetLogFile: app:'/LM/W3SVC/874402018/ROOT'  new log:'D:\temp\iirfLog.out.2184.log'
Sat Apr 03 23:26:36 -  4660 - ReadSiteConfig: actual log file 'D:\temp\iirfLog.out.2184.log'
Sat Apr 03 23:26:36 -  4660 - ReadSiteConfig: ini file: 'C:\inetpub\wwwroot\wss\VirtualDirectories\publish.college.local80\Iirf.ini'
Sat Apr 03 23:26:36 -  4660 - ReadSiteConfig: ini file timestamp: 2010/04/03 23:24:03 GMT Daylight Time
Sat Apr 03 23:26:36 -  4660 - ReadSiteConfig: line   3: LogLevel = 5
Sat Apr 03 23:26:36 -  4660 - ReadSiteConfig: pass 1
Sat Apr 03 23:26:36 -  4660 - ReadSiteConfig: line   4: StatusUrl /iirfStatus
Sat Apr 03 23:26:36 -  4660 - ReadSiteConfig: line   4: StatusUrl is enabled for local requests only.
Sat Apr 03 23:26:36 -  4660 - ReadSiteConfig: line   6: RewriteRule (rule 1)  '^/aboutus/news/([0-9]+)$'  '/aboutus/news/Pages/news.aspx?year=$1'      [I]
Sat Apr 03 23:26:36 -  4660 - ReadSiteConfig: not a duplicate rule...
Sat Apr 03 23:26:36 -  4660 - ParseRuleModifierFlags: '[I]'
Sat Apr 03 23:26:36 -  4660 - ParseRuleModifierFlags: token 'I'
Sat Apr 03 23:26:36 -  4660 - rule: Case Insensitive match
Sat Apr 03 23:26:36 -  4660 - ReadSiteConfig: Done reading, found 1 rules (0 errors, 0 warnings) on 7 lines
Sat Apr 03 23:26:36 -  4660 - GetSiteConfig: Obtain  site '/LM/W3SVC/874402018/ROOT' (era=0) (rc=1) (Expired=0) (ptr=0x026FFEE0)...
Sat Apr 03 23:26:36 -  4660 - HttpFilterProc: SF_NOTIFY_LOG
Sat Apr 03 23:26:36 -  4660 - ReleaseOrExpireSiteConfig: site '/LM/W3SVC/874402018/ROOT' (era=0) (rc=0) (Expired=0) (ptr=0x026FFEE0)...
Sat Apr 03 23:26:37 -  4660 - IsIniFileUpdated: C:\inetpub\wwwroot\wss\VirtualDirectories\publish.college.local80\Iirf.ini NO
Sat Apr 03 23:26:37 -  4660 - GetSiteConfig: Obtain  site '/LM/W3SVC/874402018/ROOT' (era=0) (rc=1) (Expired=0) (ptr=0x026FFEE0)...
Sat Apr 03 23:26:37 -  4660 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Sat Apr 03 23:26:37 -  4660 - DoRewrites
Sat Apr 03 23:26:37 -  4660 - GetServerVariable_AutoFree: getting 'url'
Sat Apr 03 23:26:37 -  4660 - GetServerVariable_AutoFree: 128 bytes
Sat Apr 03 23:26:37 -  4660 - GetServerVariable_AutoFree: result ''
Sat Apr 03 23:26:37 -  4660 - GetHeader_AutoFree: getting 'url'
Sat Apr 03 23:26:37 -  4660 - GetHeader_AutoFree: 19 bytes   ptr:0x0132EE30
Sat Apr 03 23:26:37 -  4660 - GetHeader_AutoFree: 'url' = '/aboutus/news/2009'
Sat Apr 03 23:26:37 -  4660 - GetServerVariable_AutoFree: getting 'QUERY_STRING'
Sat Apr 03 23:26:37 -  4660 - GetServerVariable_AutoFree: 1 bytes
Sat Apr 03 23:26:37 -  4660 - GetServerVariable_AutoFree: result ''
Sat Apr 03 23:26:37 -  4660 - GetHeader_AutoFree: getting 'method'
Sat Apr 03 23:26:37 -  4660 - GetHeader_AutoFree: 4 bytes   ptr:0x0132EF50
Sat Apr 03 23:26:37 -  4660 - GetHeader_AutoFree: 'method' = 'GET'
Sat Apr 03 23:26:37 -  4660 - DoRewrites: New Url, before decoding: '/aboutus/news/2009' 
Sat Apr 03 23:26:37 -  4660 - DoRewrites: Url (no decoding): '/aboutus/news/2009'
Sat Apr 03 23:26:37 -  4660 - EvaluateRules: depth=0
Sat Apr 03 23:26:37 -  4660 - DoRewrites: No Rewrite
Sat Apr 03 23:26:37 -  4660 - HttpFilterProc: SF_NOTIFY_URL_MAP
Sat Apr 03 23:26:37 -  4660 - HttpFilterProc: cfg= 0x026FFEE0
Sat Apr 03 23:26:41 -  1444 - Cached: DLL_THREAD_DETACH
Sat Apr 03 23:26:41 -  1444 - Cached: DLL_THREAD_DETACH
Sat Apr 03 23:26:41 -  1444 - Cached: DLL_THREAD_DETACH
Sat Apr 03 23:26:41 -  1444 - Cached: DLL_THREAD_DETACH
Sat Apr 03 23:26:41 -  1444 - Cached: DLL_THREAD_DETACH
Sat Apr 03 23:26:41 -  1444 - HttpFilterProc: SF_NOTIFY_URL_MAP
Sat Apr 03 23:26:41 -  1444 - HttpFilterProc: cfg= 0x026FFEE0
Sat Apr 03 23:26:41 -  1444 - HttpFilterProc: SF_NOTIFY_URL_MAP
Sat Apr 03 23:26:41 -  1444 - HttpFilterProc: cfg= 0x026FFEE0
Sat Apr 03 23:26:48 -  4448 - HttpFilterProc: SF_NOTIFY_LOG
Sat Apr 03 23:26:48 -  4448 - ReleaseOrExpireSiteConfig: site '/LM/W3SVC/874402018/ROOT' (era=0) (rc=0) (Expired=0) (ptr=0x026FFEE0)...
Apr 3, 2010 at 11:57 PM

The documentation isn't totally clear on this, but I believe that the following statement:

"If you specify a RewriteEngine directive in the global ini file (IirfGlobal.ini), it applies to all sites, and you cannot change this setting until you restart the filter or restart IIS itself. As with the IIrf.ini, if there is no RewriteEngine directive in IirfGlobal.ini, then the filter is enabled by default."  -- (from Global ReWriteEngine definition)

implies that a a RewriteEngine OFF directive in IirfGlobal.ini overrides any local Iirf.ini directives.  Hence this line from your log:

Sat Apr 03 23:26:37 -  4660 - DoRewrites: No Rewrite

means that rewriting is not operative.  Try setting RewriteEngine to ON in your IirfGlobal.ini file.

Apr 4, 2010 at 12:21 AM

Yeah, thanks, that seems to have resolved it. I've now got the problem of being redirected to the Windows Live login page. I've got the LiveId authentication provider hooked up to SharePoint for forms authentication using Windows Live. The page is normally accessible to anonymous users but when it's rewritten using IIrf, I get prompted for login details!

Any idea why this would happen?

Apr 4, 2010 at 12:31 AM

Ignore that last one, forgot to publish the page!