[英]Remove index.php from URLs in Kohana 2.x
我想配置Kohana 2.x以這種格式的鏈接:
http://localhost/mysite/web/admin/support
而不是這個:
http://localhost/mysite/web/admin/index.php/support
我從config.php文件中刪除了index.php
( $config['index_page'] = '';)
並在.htaccess文件中添加了以下行:
RewriteRule ^(.*)$ /index.php?/$1 [L]
如果您將鼠標懸停在鏈接上方,您可以看到鏈接就像我想要的那樣,但始終存在此錯誤:
未找到
在此服務器上找不到請求的URL / mysite / web / admin / support
我不知道如何改變我想要的配置。
在htaccess中編寫以下代碼::
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]
嘗試更多解決方案然后看
如何正確設置Kohana的.htaccess,以便URL中沒有丑陋的“index.php /”?
另見tuts ::
http://kohanaframework.org/3.0/guide/kohana/tutorials/clean-urls
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.