【发布时间】:2013-04-01 17:00:44
【问题描述】:
我今天遇到了一个奇怪的问题,我试图通过谷歌修复它,到目前为止没有运气。
问题是我在 zend 框架应用程序中有一个 IndexController.php 文件,它有一个名为 about 的简单操作,但是当我尝试通过它访问它时
http://mysite/index/about 它会给我 404
如果尝试过
http://mysite/Index/about 它将正确加载(使用大写 I)这个案例问题只给索引控制器我的其他控制器在 ubuntu 上工作正常
这里是我的 htaccess 文件,我已启用 mod_rewirte 并且 allowe_overried 已设置为 all
# Rewrite Rules for Zend Framework
RewriteEngine On
# Add File Names or Extentions of files that you want to be able to access
#RewriteRule !alternate.php|.(js|css|ico|bmp|gif|jpg|png|xml|xsl|eot|svg|ttf|woff)$ index.php
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
# Security: Do not allow Browsing of Directories
Options -Indexes
# additional headers related to security
<IfModule mod_headers.c>
# defends against 'ClickJacking' attacks by disallowing this site to be displayed in an IFRAME
Header always append X-Frame-Options DENY
# helps prevent attacks based on MIME-type confusion by rejecting css/js responses with incorrect MIME type
Header always append X-Content-Type-Options nosniff
</IfModule>
如果大家有什么想法请留言
谢谢
【问题讨论】:
-
尝试删除
RewriteCond %{REQUEST_FILENAME} -d。 -
感谢您的评论,但没有运气@faa
-
忘了提前面的 [OR] 也必须删除。有没有叫
Index的目录? -
@faa 我已删除 [OR] 不走运,我没有名为 Index 的文件夹,谢谢
-
这很奇怪。也许有一个符号链接
index,你可以尝试删除RewriteCond %{REQUEST_FILENAME} -l [OR]
标签: php apache .htaccess zend-framework mod-rewrite