Click here to show or hide the menubar.

Improving redirects


If you go to the Nodetypes list in my Scratchpad outline, you'll see a heading with the text redirect with domain att. It points to http://scripting.com/. It also has a domain attribute of 6430j.blorkmark.com.

If you go to http://6430j.blorkmark.com/toc.html, that should take you to http://scripting.com/toc.html. That's the feature I'm going to add.

Test

Approach

The redirect callback was getting invoked at the right time, but the walk would continue, and we'd fall off and call it a 404 (there is no toc.html subordinate to the redirect node).

So I changed it so that the redirect callback just sets directory attributes to indicate that it's a redirect and to say where to redirect to, and that's handled at the same place the 404 is, in the responder, at the top level. We let the scripterror call instantly transport us there skipping over all the other michegas that doesn't matter. We're redirecting.

The redirect now works the way we wanted it to.

Parts

worldOutlineSuite.viewRedirectCallback

worldOutlineSuite.responder.respond


Posted on Tuesday, April 17, 2012 at 5:52 PM by Dave Winer.