[Radiant] Subdomains and old urls

Chris Barnes randomutterings at gmail.com
Thu Apr 17 12:59:02 CDT 2008


I've got it built but its only doing 302 redirects until I figure out how to
pass a status into response.redirect but I went ahead and released it
anyway.

http://www.randomutterings.com/projects/page_redirect/

I'm open to opinions and suggestions on the code and also writing a test for
it.  You can see my attempts in the source.

On Thu, Apr 17, 2008 at 1:26 PM, Chris Barnes <randomutterings at gmail.com>
wrote:

> This is great stuff guys, thanks.  I have it all working but it redirects
> "302 Found" even if I use the following.
>
> response.redirect(part(:body).content, "301 Moved Permanently"
>
> I've tried googling for answers but all I can find on redirecting 301 in
> ruby is to use redirect_to which is not available in the model.  Any
> suggestions?
>
>
> On Thu, Apr 17, 2008 at 11:25 AM, Sean Cribbs <seancribbs at gmail.com>
> wrote:
>
> > Chris,
> >
> > You'll need to make an extension, first, put the page class in the
> > extension under app/models, and then "mention" it in the activate method of
> > your extension class, like so:
> >
> > class RedirectExtension < Radiant::Extension
> >  #....
> >  def activate
> >   RedirectPage
> >  end
> > end
> >
> > At some point, I'd like to have extensions automatically load page
> > classes, but that may be a feature for the next release.
> >
> > Sean
> >
> >
> > Chris Barnes wrote:
> >
> > > How do you get the new page type to show as an option under page types
> > > in
> > > the radiant admin?
> > >
> > > On Thu, Apr 17, 2008 at 9:45 AM, Sean Cribbs <seancribbs at gmail.com>
> > > wrote:
> > >
> > >
> > >
> > > > I did something similar for Redken... essentially create a new Page
> > > > type
> > > > called RedirectPage that does the redirection for you:
> > > >
> > > > class RedirectPage < Page
> > > >  def process(request, response)
> > > >  response.redirect(part(:body).content, "301 Moved Permanently")
> > > >  end
> > > > end
> > > >
> > > > Then fill in the URL in the "body" part of the page and set the page
> > > > type
> > > > to "Redirect".  Of course, this will need to be in an extension.
> > > > (Also, I'm
> > > > not 100% positive on the syntax above, be sure to check.)
> > > >
> > > > Sean
> > > >
> > > >
> > > > Chris Barnes wrote:
> > > >
> > > >
> > > >
> > > > > I ended up leaving the blog on typo and its running at
> > > > > blog.randomutterings.com.  The rest of the site is now on radiant
> > > > > at
> > > > > www.randomutterings.com.  Can anyone tell me the simplest way to
> > > > > do a
> > > > > 301
> > > > > redirect in Radiant?  I have 3 or 4 articles that moved to the
> > > > > blog
> > > > > subdomain and I would like to create pages in Radiant with their
> > > > > old
> > > > > urls
> > > > > and redirect them to the new ones.
> > > > >
> > > > > On Wed, Apr 9, 2008 at 11:17 AM, Mohit Sindhwani <tech at onghu.com>
> > > > > wrote:
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > > Chris Barnes wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > > My site runs under www.randomutterings.com <
> > > > > > > http://www.randomutterings.com>.  The live site is still on
> > > > > > > typo so
> > > > > > > ignore that.  Once I finish changing over to radiant, the blog
> > > > > > > will
> > > > > > > be at
> > > > > > > www.randomutterings.com/blog/ <
> > > > > > > http://www.randomutterings.com/blog/>.
> > > > > > >  I
> > > > > > > would like to make the blog run at blog.randomutterings.com <
> > > > > > > http://blog.randomutterings.com> instead.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > OK, I fear I may not be able to help with that.  If your blog
> > > > > > (only)
> > > > > > was
> > > > > > on Radiant, it would be quite simple.  That's the bit I've done
> > > > > > :(
> > > > > >
> > > > > > Sorry but I think someone else will need to jump in here :-|
> > > > > >
> > > > > > Cheers,
> > > > > > Mohit.
> > > > > > 4/9/2008 | 11:17 PM.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > _______________________________________________
> > > > Radiant mailing list
> > > > Post:   Radiant at radiantcms.org
> > > > Search: http://radiantcms.org/mailing-list/search/
> > > > Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
> > _______________________________________________
> > Radiant mailing list
> > Post:   Radiant at radiantcms.org
> > Search: http://radiantcms.org/mailing-list/search/
> > Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
> >
>
>
>
> --
> Chris Barnes
> http://www.randomutterings.com
>



-- 
Chris Barnes
http://www.randomutterings.com


More information about the Radiant mailing list