【发布时间】:2011-06-25 10:57:23
【问题描述】:
我的 Kohana 3 应用程序使用了相当多的 $_GET 参数。但是,当我部署应用程序时,我得到了一个空白页,其中只有文本“未指定输入文件”。通过更改我的 .htaccess 文件,我很快找到了解决这个看似常见问题的方法:
RewriteRule .* index.php/$0 [PT,L]
到
RewriteRule .* index.php?$0 [PT,L]
但是现在我的 $_GET 数组丢失了所有传递的参数。任何不需要 $_GET 的页面都可以正常工作。我不太擅长 .htaccess 文件,但据我所知,添加 ?已将 $_GET 数组替换为 uri。
我也试过
RewriteRule .* index.php/?$0 [PT,L]
和
RewriteRule .* index.php?/$0 [PT,L]
但无济于事。
以下是我的完整 .htaccess 文件(与 example.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 [F,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,L]
我找到的最接近解决方案的是这篇文章: http://forum.kohanaframework.org/discussion/comment/4857/#Comment_4857 然而,这似乎是针对较旧版本的 Kohana,我不确定这在 Kohana v3 中如何工作。
【问题讨论】:
标签: php apache .htaccess kohana kohana-3