Catch all error for incorrect urls etc

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

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


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Tom D.

http://blog.atomgiant.com
http://gifthat.com

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

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

On 4/26/06, Tom D. [email protected] wrote:

I am changing a very standard old school website to rails. When I make
http://lists.rubyonrails.org/mailman/listinfo/rails
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Tom D.

http://blog.atomgiant.com
http://gifthat.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs