目前,使用Kohana的3.1,我可以通過訪問我的控制器:如何從網址中的Kohana刪除的index.php 3.1
http://localhost/kohana/index.php/admin
不過,我想訪問它們沒有「的index.php 「在中間,如:
我怎麼能這樣做?我是否需要更改我的.htaccess文件或某些配置選項?
我使用提供的Kohana中的.htaccess:
# Turn on URL rewriting RewriteEngine On # Installation directory RewriteBase/ # Protect hidden files from being viewed Order Deny,Allow Deny From All # Protect application and system files from being viewed RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L] # Allow any files or directories that exist to be displayed directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Rewrite all other URLs to index.php/URL RewriteRule .* index.php/$0 [PT]
完美!本地主機上的任何人都應該注意,base_url或htaccess中不需要「localhost」。 (kohana 3.2對我來說) – 2012-04-26 03:59:46