【问题标题】:Kohana 3.3 Routing Issue - .htaccess?Kohana 3.3 路由问题 - .htaccess?
【发布时间】:2013-12-23 21:07:35
【问题描述】:

我有以下 bootstrap.php 路由(默认):

Route::set('default', '(<controller>(/<action>(/<id>)))')
    ->defaults(array(
        'controller' => 'Index',
        'action'     => 'index',
    ));

我的文件结构如下:

application/
  classes/
    Constroller/
      Auth.php

我有以下 .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]

我在一个 opensuse 11 Amazon EC2 实例上,当我转到 mydomain.com/authmydomain.com/Auth 时,我收到了来自 Apache 的通用 404 消息。我的 htaccess 可能有问题吗?

【问题讨论】:

  • 你确定你的htaccess文件正在被apache读取吗?
  • @JonLin 这当然是一个好点。你是说我应该看看我的 AllowOverride 设置。我会回来报告的。
  • 好吧,确保 htaccess 文件可以被 apache 读取(例如 644 或一些类似的模式),以及检查覆盖设置
  • @JonLin 您的 AllowOverride 提示完全正确。我是白痴/。
  • 您可能想查看 mod_dir 中的 FallbackResource 指令。 FallbackResource /index.php 应该能够替换 apache 2.2.16 及更高版本上的点文件、应用程序、模块和系统保护之外的所有内容。如果将应用、模块和系统保护放在webroot之外,则不需要,建议这样做。

标签: php .htaccess kohana kohana-3


【解决方案1】:

确保 htaccess 文件可由 apache 读取(例如 644 或一些类似模式),并且 server/vhost 配置中的 AllowOverride 设置设置为适当的值(AllFileInfo)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    相关资源
    最近更新 更多