I've got a 4.8 website running in integrated mode on a Win 08 R2. I want to do some 301 redirects on .html requests but I've run in to some trouble. Heres what I did.
1) Added a http handler wildcard (*, point to 64 bit aspnet_isapi)
I just thought that I pointed .html to aspnet_isapi and that's where you're handler might catch it - but your answer says that the package work in Umbraco context, only handling what hits Umbraco and not the website aspnet context.
Any pointers? UrlRewriting? Another package?
Sidenode - I still think it's odd that any .html page request comes up blank.
I'm also going to work with Lee Messenger to create a nicer version of the 301 URL Tracker, which likely will work through an HttpModule instead of 404handlers, so it's not dependent on umbraco anymore.
You should do a rewrite, not redirect (rewrite .html to .aspx) and then give the 301 response via the URL Tracker, so it will give 301 on the original request.
Also you can combine the two rules you've created by using this as the virtualUrl: "(.+)\.html?"
<add name="htm and html to aspx" ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite" redirect="None" virtualUrl="(.+)\.html?" destinationUrl="$1.aspx" />
Though I'm not really experienced with UrlRewriting.NET, I always use the IIS UrlRewrite module.
Thanks for your time. It was just that I saw the HTML in the virtualUrl="(.+)\.html?" - and that looks like it only hits the .html extension and ? is the joker for 1 char right?
Wildcard handlers and 404 redirects
Hi all,
I've got a 4.8 website running in integrated mode on a Win 08 R2. I want to do some 301 redirects on .html requests but I've run in to some trouble. Heres what I did.
1) Added a http handler wildcard (*, point to 64 bit aspnet_isapi)
Result: Standard IIS 7 404 error message.
2) Added <httpErrors existingResponse="PassThrough" />
Result: While getting rid of standard error, now my site accepts any .html request without any error at all.. Just serves a blank html page..
3) Added http://our.umbraco.org/projects/developer-tools/301-url-tracker and set it up to handle some tests like /fish.html
Result: Same as after 2)
Any clues?
best
Jesper
Yes, umbraco doesn't handle requests other than *.aspx and directory URL's, so the 301 URL Tracker isn't receiving the request.
Thanks for responding.
I just thought that I pointed .html to aspnet_isapi and that's where you're handler might catch it - but your answer says that the package work in Umbraco context, only handling what hits Umbraco and not the website aspnet context.
Any pointers? UrlRewriting? Another package?
Sidenode - I still think it's odd that any .html page request comes up blank.
Thx,
Jesper
http://our.umbraco.org/projects/developer-tools/301-url-tracker/bug-reports/19029-Getting-InfoCasters-301-URL-Tracker-to-handle-starhtml-extensions-
I'm also going to work with Lee Messenger to create a nicer version of the 301 URL Tracker, which likely will work through an HttpModule instead of 404handlers, so it's not dependent on umbraco anymore.
Thanks again. That pointed me to the solution. Here's the two rewrites:
quick note related to if you use the 301 tracker .. when adding custom redirects you need to change the extension to .aspx like this:
Old page url you want to catch
/whatever.html
Add the following to 301 tracker in stead:
/whatever.aspx
This will serve your whatever.html
This I guess results in double 301 - if anyone has any comments on that I'm all ears.
Thx
Jesper
You should do a rewrite, not redirect (rewrite .html to .aspx) and then give the 301 response via the URL Tracker, so it will give 301 on the original request.
Also you can combine the two rules you've created by using this as the virtualUrl: "(.+)\.html?"
Sure U mean virtualUrl: "(.+)\.html?"
and not virtualUrl: "(.+)\.htm?"
(I'm officially declaring myself incompatible with regexp :)
Sorry, I'm not following you?
I guess this is the rule you need:
Though I'm not really experienced with UrlRewriting.NET, I always use the IIS UrlRewrite module.
Thanks for your time. It was just that I saw the HTML in the virtualUrl="(.+)\.html?" - and that looks like it only hits the .html extension and ? is the joker for 1 char right?
I'm just gonna try :-)
Jesper
http://www.regular-expressions.info/optional.html
Ohh thankx - now I see it ..
is working on a reply...