开发者

Remove index.php from URLs in Kohana 2.x

I want to configure Kohana 2.x to have links in this format:

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

instead of this:

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

I removed the index.php from the config.php file ( $config['index_page'] = '';) and I added the following line in the .htaccess file:

Re开发者_JAVA技巧writeRule ^(.*)$ /index.php?/$1 [L]

If you hover above a link you can see that the links are like I wanted them but there is always this error:

Not Found

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

I don't know how to change the configuration like I want to.


Write following code in htaccess::

RewriteEngine On

RewriteBase /

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

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

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

you can also change the config.php file to:

$config['index_page'] = '';

another one try

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

try more solution then see
How to set up .htaccess for Kohana correctly, so that there is no ugly "index.php/" in the URL?
see also following tuts::
http://kohanaframework.org/3.0/guide/kohana/tutorials/clean-urls

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜