2011-03-01 38 views
3

我想配置的Kohana 2.x到具有這種格式的鏈接:從網址中的Kohana 2.x中刪除的index.php

http://localhost/mysite/web/admin/support 

,而不是這樣的:

http://localhost/mysite/web/admin/index.php/support 

我刪除了index.php從config.php文件($config['index_page'] = '';)和我加在.htaccess文件中的行:

RewriteRule ^(.*)$ /index.php?/$1 [L] 

如果您鼠標懸停在一個鏈接上面你可以看到鏈接是像我想他們,但總有這樣的錯誤:

Not Found
The requested URL /mysite/web/admin/support was not found on this server

我不知道如何更改配置像我想。

htaccess的

回答

1

寫下面的代碼::

RewriteEngine On 

RewriteBase/

RewriteRule ^(application|modules|system) - [F,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule .* index.php/$0 [PT,L] 

你也可以改變config.php文件到:

$config['index_page'] = '';

另一個嘗試

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule !^index\.php index.php%{REQUEST_URI} [L] 

嘗試更多的解決方案,然後見
How to set up .htaccess for Kohana correctly, so that there is no ugly "index.php/" in the URL?
個 請參閱下TUTS ::
http://kohanaframework.org/3.0/guide/kohana/tutorials/clean-urls

+0

現在得到另一個消息: 請求的URL /index.php/support此服務器上找到。 我沒有安裝梨.. – mathew 2011-03-01 17:03:08

+0

現在的第三個解決方案。 – 2011-03-01 17:07:58

+0

我也編輯了這行$ config ['index_page'] =''; – mathew 2011-03-01 17:08:08