【问题标题】:Zend Framework - URL's not workingZend 框架 - URL 不起作用
【发布时间】:2012-04-10 13:46:26
【问题描述】:

我将我的网站上传到实时环境,默认索引/索引工作正常。我已经使用

过滤掉了 index.php 文件
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

当我在浏览器中输入直接路由mysite.com/index/index 时,我得到一个 404 页面。键入 mysite.com/index.php/index/index 会导致“未指定输入文件”。信息。 访问我的任何其他网站 URL 时,我都会收到这些相同的消息。谁能指出我正确的方向吗?

【问题讨论】:

  • 您的直播环境使用什么网络服务器软件?如果是 Apache,那些重写规则放在哪里(.htaccesshttpd.conf 等)?
  • 不是 htaccess 大师 - 最后一行需要转义吗? RewriteRule ^.*$ index\.php [NC,L]?

标签: php apache zend-framework mod-rewrite


【解决方案1】:

规则是正确的。 .htaccess 必须在公用文件夹中。最后检查是否有其他的.htaccess(例如在public的父目录中)。

【讨论】:

    【解决方案2】:

    确保 mod_rewrite 已启用,并且所有对 mysite.com 的调用都应重定向到 /public/index.php 文件

    【讨论】:

      【解决方案3】:

      同时在 vhost.conf 中将 'AllowOveride none' 更改为 'AllowOveride All'

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-02-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多