.htaccess for OpenShift上的PHP

My directory structure is:

> app
   - controllers
   - core
   - includes
   - models
   - views
   - .htaccess
   - init.php
> public
   - css
   - fonts
   - images
   - js
   - .htaccess
   - index.php

The .htaccess file inside public directory is configured as:

Options -MultiViews
RewriteEngine On

RewriteBase /public

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

And the one in app directory as:

Options -Indexes

I have hosted the application on OpenShift. Though this configuration works well locally but throws 500 Server Error on OpenShift. Help?

What is probably happening is that the 'public' directory is being selected as your document root, and the files in app are not web accessible because they are outside of the document root. You can see how the document root is chosen here (https://github.com/openshift/origin-server/blob/master/cartridges/openshift-origin-cartridge-php/usr/lib/php_config), you should also check your log files (https://developers.openshift.com/en/managing-log-files.html) to get more information about the error that is being generated.