Top Level Folder name in Rails Route


I have a rails app who’s code is in /home/myRailsApps/testapp, with /home/ a symlink to /home/myRailsApps/testapp/public.

In my log I am seeing ActionController::RoutingError (No route matches “/testapp/gear_items” with {:method=>:get}):

The folder name that the application is sitting in, or the subfolder in the URL is appearing in the route request.

From the tutorials I’ve been following, the route request should be gear_items, and the URL I am going to is

How can I get rid of the “/testapp/” that’s getting prefixed to the route request?

Is this to do with the Apache .htaccess?

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

Many thanks,


Turned out I needed the following configuration to be declared!

config.action_controller.relative_url_root = ‘/subdirectory’

All the best,