Kohana正在.htaccess中重写URL,显示“未找到文件”消息

Kohana正在.htaccess中重写URL,显示“未找到文件”消息,.htaccess,url-rewriting,kohana,kohana-3,kohana-3.2,.htaccess,Url Rewriting,Kohana,Kohana 3,Kohana 3.2,我使用的是Kohana3.2框架,我将标准的.htaccess文件放在应用程序的同一文件夹中 我的.htaccess文件是 # Turn on URL rewriting RewriteEngine On # Installation directory RewriteBase /mysite/ # Protect hidden files from being viewed <Files .*> Order Deny,Allow Deny Fro

我使用的是Kohana3.2框架,我将标准的.htaccess文件放在应用程序的同一文件夹中

我的.htaccess文件是

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /mysite/

# 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]
但它仍然显示

找不到

在此服务器上找不到请求的URL/index.php/login

还有

Running in Apache 2.2.3 over CentOS 5

有什么想法吗?

你可以试试我的Kohana.htaccess文件

# Set environment
SetEnv KOHANA_ENV "development"

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#设置环境
SetEnv KOHANA_环境“发展”
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
我也使用Kohana 3.2。这种重写通常适用于我的大多数项目


让我知道结果如何

你可以试试我的Kohana.htaccess文件

# Set environment
SetEnv KOHANA_ENV "development"

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#设置环境
SetEnv KOHANA_环境“发展”
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
我也使用Kohana 3.2。这种重写通常适用于我的大多数项目


让我知道结果如何

在你的bootstrap.php-inside-Kohana::init-set'index\u file'=>'',在你的bootstrap.php-inside-Kohana::init-set'index\u file'=>'',我知道了!! 下面是当应用程序位于其他文件夹中时如何完成的

The complete path of the app is /var/www/es/ec/mysite

The complete working URL is http://10.0.0.1/ec/mysite/index.php/login

The complete NOT working URL was http://10.0.0.1/ec/mysite/login
在/var/www/es/ec/mysite/application/bootstrap.php中,Kohana::init保持如下状态

Kohana::init(array(
    'base_url'   => '/ec/mysite/',
    'index_file'   => FALSE,
    'charset' => 'ISO-8859-1',
));
# 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 .* /ec/mysite/index.php/$0
还有像这样的.htaccess

Kohana::init(array(
    'base_url'   => '/ec/mysite/',
    'index_file'   => FALSE,
    'charset' => 'ISO-8859-1',
));
# 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 .* /ec/mysite/index.php/$0
#启用URL重写
重新启动发动机
#安装目录
重写基/
#保护隐藏文件不被查看
命令拒绝,允许
全盘否定
#保护应用程序和系统文件不被查看
重写规则^(?:应用程序|模块|系统)\b.*index.php/$0[L]
#允许直接显示现有的任何文件或目录
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#将所有其他URL重写为index.php/URL
重写规则。*/ec/mysite/index.php/$0
希望这对其他人有帮助! 干杯我得到了它!! 下面是当应用程序位于其他文件夹中时如何完成的

The complete path of the app is /var/www/es/ec/mysite

The complete working URL is http://10.0.0.1/ec/mysite/index.php/login

The complete NOT working URL was http://10.0.0.1/ec/mysite/login
在/var/www/es/ec/mysite/application/bootstrap.php中,Kohana::init保持如下状态

Kohana::init(array(
    'base_url'   => '/ec/mysite/',
    'index_file'   => FALSE,
    'charset' => 'ISO-8859-1',
));
# 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 .* /ec/mysite/index.php/$0
还有像这样的.htaccess

Kohana::init(array(
    'base_url'   => '/ec/mysite/',
    'index_file'   => FALSE,
    'charset' => 'ISO-8859-1',
));
# 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 .* /ec/mysite/index.php/$0
#启用URL重写
重新启动发动机
#安装目录
重写基/
#保护隐藏文件不被查看
命令拒绝,允许
全盘否定
#保护应用程序和系统文件不被查看
重写规则^(?:应用程序|模块|系统)\b.*index.php/$0[L]
#允许直接显示现有的任何文件或目录
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#将所有其他URL重写为index.php/URL
重写规则。*/ec/mysite/index.php/$0
希望这对其他人有帮助!
干杯您好,Brent Lingle,我尝试了您的.htaccess,但它仍然显示“未找到-此服务器上未找到请求的URL/index.php”消息。对于我在Centos5服务器上使用Apache 2.2.3的记录。您好,Brent Lingle,我尝试了您的.htaccess,但它仍然显示“未找到-此服务器上未找到请求的URL/index.php”消息。对于记录,我在Centos5服务器上使用了Apache2.2.3。感谢Meliborn,仍然收到同样的消息。还尝试使用'index_file'=>'index.php',并使用默认参数'index_file'=>FALSE。有什么想法吗???'base\u url'=>dirname($\u SERVER['SCRIPT\u NAME'])谢谢Meliborn,仍然收到同样的消息。还尝试使用'index_file'=>'index.php',并使用默认参数'index_file'=>FALSE。有什么想法吗??'base\u url'=>dirname($\u SERVER['SCRIPT\u NAME'])