Remove index.php from urls in Kohana 2.x

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

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

instead of this:

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

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

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

If you hover over the link, you will see that the links are similar to me, but there is always this error:

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

I do not know how to change the configuration as I want.

+3
source share
1 answer

Write the 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 attempt

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

, .htaccess Kohana, " index.php/" URL? . ::
http://kohanaframework.org/3.0/guide/kohana/tutorials/clean-urls

+1

Source: https://habr.com/ru/post/1795549/


All Articles