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).