Yeah, except I'm concerned that if I do this, I'll end up with loops (or at least requests for index.html will be redirected). All my pages are index.html, and all the pages I need to redirect from are not. So I intended to do a regex that grabbed everything that ended in html but was not index.html (except that I'm having a hell of a time writing that regex, so I'm just doing a list of pages to redirect).
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)) } Right? Chas. Tim Perrett wrote: > Chas, > > As it happens, I need to do this also. For me, im porting a rails app, > so dont have the .html issues and im doing case by case redirects. So, > I have something like: > > LiftRules.dispatch.prepend { > case r @ Req("about" :: Nil, "", _) => () => Full > (PermRedirectResponse("/about-us",r)) > } > > However, if you want to redirect all your html pages back to the > index, you'd need something like: > > LiftRules.dispatch.prepend { > case r @ Req(page, "html", _) => () => Full(PermRedirectResponse > ("/",r)) > } > > Does that make sense? > > Cheers, Tim > > On Jan 24, 3:30 am, "Charles F. Munat" <c...@munat.com> wrote: >> Thanks! That helps. I'll try to figure it out. >> >> Chas. >> >> Marius wrote: >>> LiftRules.prepend.dispatch is the right way. >>> You pattern-match for *.html and return a PermRedirectResponse. >>> Br's, >>> Marius >>> On Jan 23, 3:05 am, "Charles F. Munat" <c...@munat.com> wrote: >>>> I'm trying to do something dead simple, so it's impossible, of course. >>>> I have some legacy pages that don't exist anymore, and I want to send >>>> permanent (301) redirects to the browser. For example: >>>> Redirect permanent /thebook.htmlhttp://mysite.com/the_book/ >>>> The above should work in my vhosts.d conf file, but, of course, it >>>> doesn't. Have tried it 50 ways. >>>> Searched for information about how to do redirects in Jetty: no joy. >>>> David gave me a hint some time ago using LiftRules.prepend.dispatch, but >>>> I'm too stupid to understand it. >>>> What I *really* want is for any request to any *.html page NOT >>>> index.html to go to the home page. Or, I'd be happy to just provide a >>>> list of from and to paths and have some code that does the redirects. >>>> This seems like a useful feature since my Lift sites will often replace >>>> legacy sites and it would be nice to be able to set up a list of old >>>> page -> new page and just have the redirects go out (maybe with the >>>> option of permanent or temporary). >>>> Anyone know how to do this that can explain it in kindergarten terms? My >>>> brain is really fried today. >>>> Thanks! >>>> Chas. > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---