Openshift 上的 ZF2 应用程序:当不是“/”时找不到 404
ZF2 application on Openshift: 404 not found when not '/'
我刚刚在 Openshift 上部署了一个小型 ZendFramework 2 应用程序 here。
主页正确显示,但当我尝试登录时,出现 404 未找到。 URL 是 /authenticate
。事实上任何非 /
url 都不起作用。
为什么?
更新
我的 http.conf
包含:
DocumentRoot ${OPENSHIFT_REPO_DIR}/public
<Directory "${OPENSHIFT_REPO_DIR}/public">
Options +Indexes +FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.php index.html index.cgi
AccessFileName .htaccess
<Files ~ "^\.ht">
Order deny,allow
Deny from all
</Files>
并且/public
中有一个.htaccess
:
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}:: ^(/.+)(.+)::$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
问题出在我的 http.conf
,我将 AllowOverride None
更改为 AllowOverride All
。
我刚刚在 Openshift 上部署了一个小型 ZendFramework 2 应用程序 here。
主页正确显示,但当我尝试登录时,出现 404 未找到。 URL 是 /authenticate
。事实上任何非 /
url 都不起作用。
为什么?
更新
我的 http.conf
包含:
DocumentRoot ${OPENSHIFT_REPO_DIR}/public
<Directory "${OPENSHIFT_REPO_DIR}/public">
Options +Indexes +FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.php index.html index.cgi
AccessFileName .htaccess
<Files ~ "^\.ht">
Order deny,allow
Deny from all
</Files>
并且/public
中有一个.htaccess
:
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}:: ^(/.+)(.+)::$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
问题出在我的 http.conf
,我将 AllowOverride None
更改为 AllowOverride All
。