views:

183

answers:

2

I used Passenger to deploy a RoR app to a sub URI on my domain. The problem I'm facing is that the sub URI seems to be case sensitive. Navigating to http://mydomain.com/RailsApp resolves fine. However, if I go to http://mydomain.com/railsapp, http://mydomain.com/railsApp, or any other variation, I get a 404 error. How can these requests using different casings get resolved correctly?

Here is my Apache configuration file:

<VirtualHost *:80>
  ServerName mydomain.com
  ServerAlias www.mydomain.com
  DocumentRoot /www/mydomain/public

  <Directory "/www/mydomain/public">
      RailsEnv "production"
      Order allow,deny
      Allow from all
  </Directory>

  RailsBaseURI /RailsApp
  <Directory "/www/RailsApp/public">
      RailsEnv "development"
      Options -MultiViews
  </Directory>
</VirtualHost>

Any help is much appreciated. Thanks!

+1  A: 

You could look into using mod_rewrite and matching it case insensitive there.

Some links to get you started :)
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
http://httpd.apache.org/docs/2.2/misc/rewriteguide.html

ba
A: 

Thanks ba for pointing me in the right direction.

I did some research and found the mod_speling module. This not only makes the URL case-insensitive but also checks for spelling errors.

To enable mod_speling:

sudo /usr/sbin/a2enmod speling

sudo /etc/init.d/apache2 force-reload
sudo /etc/init.d/apache2 restart

To use mod_speling, include the directive CheckSpelling on in your virtual host section:

<VirtualHost *:80>
    CheckSpelling on

    ...
</VirtualHost>
Bryan Roth