Subdomains and old urls

I’m currently moving my blog over to Radiant. I would like to preserve
the
old links if possible but at the same time move the blog part of the
site to
a subdomain blog.randomutterings.com. For example I wrote an article on
redundant firewalls and the old url is
羞草研究所隐藏入口 - 羞含草研究研所2021 - 羞羞app正式版下载 - 羞羞动漫破解版无限金币
want the new url to be
http://blog.randomutterings.com/2007/06/15/redundant-failover-firewall-with-pf-pfsync-and-carp-on-freebsdbut
at the same time I would like to have the old url forward the user to
the new one if that is possible. Any suggestions are welcome.


Chris B.
http://www.randomutterings.com

Chris,

This sounds like a good candidate for an extension. The basic strategy
would be to override either SiteController.show_page or Page.find_by_url
to search for a page that has the passed legacy URL (you’ll need to add
a field in the database), in the case that the requested URL was not
found. If a page is found, do a Permanent redirection (301 IIRC) to the
new URL. If it isn’t found, pass through the FileNotFoundPage or
exception.

Sean

I wouldn’t mind working on that if there were enough interest. Does
anyone
else need this? Also can someone help me to set the blog page of my
site to
use a subdomain?

On Tue, Apr 8, 2008 at 5:02 PM, Sean C. [email protected]
wrote:

http://randomutterings.com/articles/2007/06/15/redundant-failover-firewall-with-pf-pfsync-and-carp-on-freebsdI
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant


Chris B.

Chris B. wrote:

I wouldn’t mind working on that if there were enough interest. Does anyone
else need this? Also can someone help me to set the blog page of my site to
use a subdomain?

Hi Chris,

Might be able to help with your second question but I’m not sure I
understand it fully. What do you mean by:

Also can someone help me to set the blog page of my site to
use a subdomain?

If you mean can it run like the way my Radiant site is running at
http://t-engine.onghu.com instead of htttp://www.onghu.com/ then I can
help you with it.

Cheers
Mohit.

My site runs under 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/. I would like to make the blog run at
blog.randomutterings.com instead.

On Wed, Apr 9, 2008 at 12:43 AM, Mohit S. [email protected] wrote:

Hi Chris,
help you with it.


Chris B.
http://www.randomutterings.com

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 S. [email protected] wrote:

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 :frowning:

Sorry but I think someone else will need to jump in here :expressionless:

Cheers,
Mohit.
4/9/2008 | 11:17 PM.


Chris B.

Chris B. 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 :frowning:

Sorry but I think someone else will need to jump in here :expressionless:

Cheers,
Mohit.
4/9/2008 | 11:17 PM.

I may be dense here but I’m not getting it from the readme. How can I
use
the multi-site plugin to create 301 redirects?

On Thu, Apr 17, 2008 at 4:12 AM, Arik J. [email protected] wrote:

301

Chris B.
http://www.randomutterings.com


Posted via http://www.ruby-forum.com/.


Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant


Chris B.

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

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 C. [email protected]
wrote:

to “Redirect”. Of course, this will need to be in an extension. (Also, I’m

301

4/9/2008 | 11:17 PM.
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant


Chris B.

Chris B. wrote:

How do you get the new page type to show as an option under page types
in the radiant admin?

The way I’ve done it in the past is (example from my Schools extension):

In …/schools/schools_extension.rb

def activate
admin.tabs.add “Schools”, “/manage/schools”, :after => “Layouts”,
:visibility => [:all]
SchoolPage
end

In …/schools/app/models/school_page.rb

class SchoolPage < Page



end

Checkout the multi-site plugin below. I think it would work well for
what you need. :slight_smile:

http://svn.radiantcms.org/radiant/trunk/extensions/multi_site/README

Chris B. 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 S. [email protected] wrote:

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 :frowning:

Sorry but I think someone else will need to jump in here :expressionless:

Cheers,
Mohit.
4/9/2008 | 11:17 PM.


Chris B.
http://www.randomutterings.com

David P. wrote:

Chris B. wrote:

How do you get the new page type to show as an option under page types
in the radiant admin?

The way I’ve done it in the past is (example from my Schools extension):

In …/schools/schools_extension.rb

def activate
admin.tabs.add “Schools”, “/manage/schools”, :after => “Layouts”,
:visibility => [:all]
SchoolPage
end

In …/schools/app/models/school_page.rb

class SchoolPage < Page



end

Given Sean’s example, I believe you would do…

def activate
RedirectPage
end

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

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 C. [email protected]
wrote:

end

How do you get the new page type to show as an option under page types

called RedirectPage that does the redirection for you:
(Also, I’m

blog.randomutterings.com. The rest of the site is now on radiant at

My site runs under www.randomutterings.com <


Chris B.

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.

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 B.
[email protected]
wrote:

On Thu, Apr 17, 2008 at 11:25 AM, Sean C. [email protected]

def activate
Chris B. wrote:

I did something similar for Redken… essentially create a new Page
type

urls

www.randomutterings.com/blog/ <
(only)

Post: [email protected]

Chris B.
http://www.randomutterings.com


Chris B.
http://www.randomutterings.com