Q:

Only root route works in Sinatra with Passenger/Apache

I have a sinatra app running with Apache/Passenger in a subfolder with the following in an .htaccess file
<IfModule mod_passenger.c>
  Options -MultiViews
  Allow from all
  PassengerResolveSymlinksInDocumentRoot on
  RackEnv development
  RackBaseURI /myapp
  PassengerAppRoot /home/username/myapp
  SetEnv GEM_HOME /mypath/ruby/gems
</IfModule>

and my Sinatra app has two routes
get '/' do
  'Root Request'
end

get '/ok' do
  'Ok Request'
end

My root route works fine but my second route never gets called. I'm guessing its something between Passenger and Apache configuration but I can't figure it out.
This is running on a shared host so I only have access to my home directory and not the full Apache config.

A:

Ok, so I had to look outside the box.
The problem was in the .htacess file of the parent folder (root of the site) which has a mod_rewrite rule like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

After adding my app folder with the following condition, everything started working as expected:
RewriteCond %{REQUEST_URI} !^/myapp(.*)$ [NC]

