Ah, that's a clever idea.

Chas.

David Pollak wrote:
> Charles,
> 
> Place the following lines in Boot.scala:
> 
>     LiftRules.passNotFoundToChain = false
>     LiftRules.uriNotFound.prepend {
>       case (r, _) => PermRedirectResponse("/", r)
>     }
> 
> This will work in 0.11-SNAPSHOT (there was a bug in 0.10 that prevents 
> it from working).
> 
> Any URL not found will be redirected to "/".
> 
> Please wait an hour for the fix to propagate through Hudson and 
> scala-tools.org <http://scala-tools.org>.
> 
> Thanks,
> 
> David
> 
> On Sat, Jan 24, 2009 at 11:35 AM, Charles F. Munat <c...@munat.com 
> <mailto:c...@munat.com>> wrote:
> 
> 
>     All my templates are index.html. I use the folder name. And I never call
>     them by index (I rewrote the Menu functions to avoid that). So I call
>     /the_book/ and I get /the_book/index.html. But if someone entered
>     /the_book/index.html, I'd still want it to work.
> 
>     But you've made me realize that this might work:
> 
>     LiftRules.dispatch.prepend {
>       case r @ Req(page :: Nil, "html", _) => if (page != "index") =>
>        Full(PermRedirectResponse("/", r))
>     }
> 
>     That said, using this one I give up specific redirects in favor of
>     sending everything to the home page. I think I like the other one
>     better.
> 
>     Thanks for all your help!
> 
>     Chas.
> 
>     Tim Perrett wrote:
>      > When you say all your pages are index.html, how do you mean? if your
>      > file is index.html, in lift the URI would be /index right?
>      >
>      >
>      >> Anyway, this helps a lot. So if I want to redirect thebook.html to
>      >> /the_book/ I would do this:
>      >>
>      >> LiftRules.dispatch.prepend {
>      >>    case r @ Req("thebook" :: Nil, "html", _) => () => Full(
>      >>      PermRedirectResponse("/the_book", r))
>      >>
>      >
>      > Correct :-)
>      >
>      >
>      >
>      > >
> 
> 
> 
> 
> 
> -- 
> Lift, the simply functional web framework http://liftweb.net
> Collaborative Task Management http://much4.us
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to