我正在使用Kohana 3.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]
我尝试将las线改为
RewriteRule ^(.*)$ /index.php/$0
RewriteRule ^(.*)$ /index.php/$0 [PT,L]
RewriteRule ^(.*)$ /index.php/$0 [PT,L,QSA]
RewriteRule .* /index.php/$0 [PT] - [PT,L] - [PT,L,QSA]
但它仍然显示
未找到
在此服务器上找不到请求的网址/index.php/login。
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 is http://10.0.0.1/ec/mysite/login
也...
Running in Apache 2.2.3 over CentOS 5
任何想法???
答案 0 :(得分:1)
以下是应用程序在其他文件夹中时的完成方式。
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',
));
像这样的.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 .* /ec/mysite/index.php/$0
答案 1 :(得分:0)
您可以尝试我的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>
我也使用Kohana 3.2。这种重写往往适用于我的大多数项目。
让我知道它是如何运作的!
答案 2 :(得分:0)
在Kohana中的bootstrap.php :: init set'index_file'=&gt; '',