Forum: Ruby on Rails catch all error for incorrect urls etc

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Peter M. (Guest)
on 2006-04-26 10:23
(Received via mailing list)
Hi,

I am changing a very standard old school website to rails. When I make
the change to rails, all of the old urls will not be valid. If a
person has a bookmark to an old web page I would like them to be
directed to the front page of the new website www.domain.com. How do I
do this? Do I do something in routes.rb?

Thanks,
Peter
Tom D. (Guest)
on 2006-04-26 18:54
(Received via mailing list)
You could just change your public/404.html page to add a meta
redirect.  I would probably recommend putting in a slight delay so
legitimate 404's don't cause people to be redirected without an
explanation.

Tom

On 4/26/06, Peter M. <removed_email_address@domain.invalid> wrote:
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Tom D.

http://blog.atomgiant.com
http://gifthat.com
Peter M. (Guest)
on 2006-04-26 19:20
(Received via mailing list)
Hi Tom,

For example, a missing action error doesn't seem to produce my
404.html page anyway.

I could use the flash and then redirect to the front of the site.
However I still don't know where to do the "catch all"

Peter
Tom D. (Guest)
on 2006-04-27 04:36
(Received via mailing list)
Hi Peter,

The 404 should work for any missing pages.  One thing worth mentioning
is if you are running in development mode Rails will render a built-in
404.rhtml for missing actions.  However, in production mode, it will
render the public/404.html.

For your original question about stale URLs to the old site, they
should be handled adequately by the public/404.html.

Try changing your environment to production and try it again.

Let me know if you have any questions.

Tom

On 4/26/06, Peter M. <removed_email_address@domain.invalid> wrote:
> On 4/26/06, Tom D. <removed_email_address@domain.invalid> wrote:
> > > I am changing a very standard old school website to rails. When I make
> > > http://lists.rubyonrails.org/mailman/listinfo/rails
> > removed_email_address@domain.invalid
> > http://lists.rubyonrails.org/mailman/listinfo/rails
> >
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Tom D.

http://blog.atomgiant.com
http://gifthat.com
This topic is locked and can not be replied to.