.htaccess for PHP on OpenShift


.htaccess for PHP on OpenShift

我的目录结构是:

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

public目录中的.htaccess文件配置为:

Options -MultiViews
RewriteEngine On
RewriteBase /public
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

app目录中的一个为:

Options -Indexes

我已经在OpenShift上托管了该应用程序。尽管此配置在本地运行良好,但会在OpenShift上抛出500 Server Error。帮助

可能发生的情况是,"public"目录被选为您的文档根目录,并且应用程序中的文件不可通过web访问,因为它们在文档根目录之外。您可以在此处查看如何选择文档根(https://github.com/openshift/origin-server/blob/master/cartridges/openshift-origin-cartridge-php/usr/lib/php_config),您还应该检查日志文件(https://developers.openshift.com/en/managing-log-files.html)以获取有关正在生成的错误的更多信息。