【发布时间】:2015-11-02 16:30:01
【问题描述】:
我的 Kohana 3.3 项目的 .htaccess 文件是:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
按照 Eric 的建议,我已将 htaccess 更新为以下内容:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Protect hidden files from being viewed
<Files ".*">
Require all denied
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php/$0 [PT]
我更新了虚拟主机以包括:
<Directory /srv/www/example.com/public_html/>
Require all granted
</Directory>
我错过了什么吗?
【问题讨论】:
-
您的 Apache 错误日志是怎么说的?
-
你现在得到 404 了吗?
-
你应该阅读httpd.apache.org/docs/2.4/upgrading.html关于允许拒绝部分
-
@Eric 谢谢错过那个 - 仍然得到 404。
-
请用您的新规则更新主帖
标签: php apache .htaccess kohana