ZF2路由器不工作的分期 [英] ZF2 router not working on staging

查看:122
本文介绍了ZF2路由器不工作的分期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个ZF2项目在本地运行,它的伟大工程。当我将它设置了一个临时服务器上我遇到了一个路由问题。它的路线/到合适的控制器,但访问时,说/博客它会寻找一个实际的文件夹,并返回以下错误:

So I have a ZF2 project running locally and it works great. When I set it up on a staging server I ran into a routing problem. It routes "/" to the proper controller but when visiting, say "/blog" it will look for an actual folder and return the following error:

The requested URL /blog was not found on this server.

通常情况下,如果不匹配任何定义的路由ZF2将返回一个错误的说法,该网址无法路由匹配。但它看起来好像这打破了整个应用程序的。有没有其他人遇到了类似的问题/找到了解决?

Normally if it didn't match any defined routes ZF2 would return an error saying the that the URL could not be matched with routing. But it appears as though this is breaking out of the entire application. Has anyone else ran into similar problems/found a fix?

感谢。

推荐答案

尝试使用以下code来代替你的整个.htaccess文件。

Try to replace your whole .htaccess file with following code.

RewriteEngine叙述在

RewriteEngine On

的RewriteCond%{} REQUEST_FILENAME -s [OR]

RewriteCond %{REQUEST_FILENAME} -s [OR]

的RewriteCond%{} REQUEST_FILENAME -l [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

的RewriteCond%{} REQUEST_FILENAME -d

RewriteCond %{REQUEST_FILENAME} -d

重写规则^ * $ - [NC,L]

RewriteRule ^.*$ - [NC,L]

的RewriteCond%{REQUEST_URI} :: $ 1 ^(/.+)(+):: \\ $ 2

RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$

重写规则^ - [E = BASE:%1](。*)

RewriteRule ^(.*) - [E=BASE:%1]

重写规则^(。*)$%{ENV:BASE}的index.php [NC,L]

RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

这篇关于ZF2路由器不工作的分期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆