Hi,
I'm trying to use IIS Isapi Rewrite to do the following...
I need seo-friendly URLs to be (silently) converted back to application friendly URLs like so:
RewriteRule ^/seo-friendly-url/ /test/index.cfm [I,L]
Simple enough.
But I also need URLs already indexed in search engines (for example) to be 301 redirected to the seo-friendly version. Like so:
RewriteRule ^/test/index.cfm /seo-friendly-url/ [I,R=301]
Each of these works fine in isolation. But when I have both in my .ini file I end up with /seo-friendly-url/ showing in my browser address bar but I'm being served a 404. (Yes, /test/index.cfm definitely exists!)
I know it looks like a circular reference, but the first rule only rewrites the URL between IIS and the application - there's no redirect, so I'm not hitting Isapi Rewrite a second time. Or am I wrong about that?
I've enabled logging on Isapi Rewrite and I'm seeing the following:
HttpFilterProc SF_NOTIFY_PREPROC_HEADERS
DoRewrites
New Url: '/seo-friendly-url/'
ApplyRules (depth=0)
Rule 1 : 1
Result (length 15): /test/index.cfm
ApplyRules (depth=1)
Rule 1 : -1
Rule 2 : 1
Result (length 18): /seo-friendly-url/
ApplyRules: returning 301
ApplyRules: returning 1
Rewrite Url to: '/seo-friendly-url/'
Anyone got any ideas?