If I can just stick my nose in here - it will be easier if you handle the redirect in the module code.
You shouldn't need to worry about which Url rewriter is being used, if you just use the Friendly Url Provider API to come up with the destination Url in the way you normally do.
The basic logic would be (when page is requested, and not a postback) :
- construct url as you would expect it for the current article (ie /articleid/1/my-article-name.aspx)
- compare this with the original, incoming Url (get this from the context). If the end of the url (everything after the page name/ tabid) doesn't match what you would expect, then do a 301 redirect to the url you do expect. When I say 'compare the end', I mean, ignore the http://domain.com/pagename/tabid/xx/ part of it. You really just want to make sure that the 'my-article-name.aspx' was on the end of the original Url.
There's probably a bit more to it if you have things like page numbers and the like to worry about, as well as when people have friendly Urls turned off. You might find it easier to inspect the rewritten query string, or perhaps to use a regex pattern to work it out.
- Doing it like this would also have the side benefit of forwarding Urls if you decide to change the title of the article after it has been indexed. Ie, I decide to change 'my article name' to 'my article keyword name'. Then, all old versions of the article that were indexed (/my-article-name.aspx) would be forwarded to the new one (/my-article-keyword-name.aspx)
Scott, feel free to send me an email if you need me to expand, but I'm sure you're on top of it. |