2011-03-01 39 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