I am trying to use IIS Isapi Rewrite to do the following ...
I need seo-friendly URLs that will (silently) be converted back to application-friendly URLs, for example:
RewriteRule ^/seo-friendly-url/ /test/index.cfm [I,L]
Simple enough.
But I also need URLs already indexed in search engines (for example) so that 301 is redirected to a seo-friendly version. For example:
RewriteRule ^/test/index.cfm /seo-friendly-url/ [I,R=301]
Each of these works is perfectly isolated. But when I have both in my .ini file, I get / seo-friendly-url / showing in my browser address bar, but they give me 404. (Yes, / test / index.cfm definitely exists!)
I know this looks like a circular link, but the first rule only rewrites the URL between IIS and the application - there is no redirect there, so I won’t beat Isapi Rewrite a second time. Or am I wrong about that?
I have enabled recording in Isapi Rewrite and I see 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/'
Does anyone have any idea?
source
share