Web Hosting Plus Logo



Web Hosting How-To Articles, Help and Information at Web Hosting Plus

Why does my Ruby on Rails custom installation return 404 errors?

Back to Help Main Page

If you've installed Ruby on Rails manually, or are using an installation from a previous web host, you may find that your Rails pages do not display - instead showing a "404 Not Found" error message.

This is caused by a missing or incorrect .htaccess file in Ruby's public folder. This file tells the web server how to correctly understand Rails paths.

Fortunately, this is easy to fix, as we have created a simple script you can run to generate the correct .htaccess for Ruby on Rails. If your Ruby installation is in the somedirectory folder under your home directory, then you would connect by SSH and do:-

[yoursite.com@web224 ~]$ cd somedirectory/public
[yoursite.com@web224 public]$ /usr/local/bin/create_rails_htaccess.pl > .htaccess

The create_rails_htaccess.pl script simply outputs a correct .htaccess file, so you can modify the command as you wish (for example, appending it to your existing .htaccess).


This is in reply to:

Why does my Ruby on Rails custom installation return 404 errors?


Web Hosting Plus Help Main Page