2012-06-01 43 views
1

我使用kohana 3.2kohana htaccess和索引結構

我的網站是www.mysite.com/best,kohana安裝得最好。

我使用與rewritebase默認htaccess文件/最佳

那麼什麼是重定向到www.mysite.com用戶的最佳方法是什麼?

現在,如果有人把www.mysite.com/helo(www.mysite.com/best/helo) 加載,但Apache不給404找不到。

我希望我的問題有道理。

編輯

如果用戶到主域(www.mysite.com),我希望它加載位於mysite的/最好的Kohana。 但如果用戶現在鍵入完整的東西,最好省略,網站將加載,但我的表單不會工作,因爲它發佈到www.mysite.com/helo而不是www.mysite.com/best/helo 而不是加載假helo控制器,它必須顯示未找到的頁面。

編輯

好,我已將此添加htaccess文件和它完美的作品

RewriteCond %{REQUEST_URI} !^/best/ 

RewriteRule ^(.*)$ /best/$1

+0

給我們您的完整.htaccess文件。加載www.mysite.com/best是否工作? www.mysite.com/best/index.php/helo是否有效? – gspatel

+0

這是kohana中的標準htaccess文件。是的,兩者都有效。如果用戶放置www.mysite.com它顯示文件夾列表沒有index.html加載。如果他們把www.mysite.com/best加載kohana index.php。現在,如果他們使用控制器,所以最好省略它的作品,但標題和螢火蟲標題說,PAGE NOT FOUND – user990664

回答

0

你不能有多個rewritebase htaccess的所以... 重寫你的規則,以適應你需要/最好 或把其他htaccess /重寫你的需求。

0

試試這個的.htaccess來代替:

# Turn on URL rewriting 
RewriteEngine On 

# Installation directory 
RewriteBase /best/ 

# 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?kohana_uri=$0 [PT,L,QSA] 
RewriteRule .* index.php?/$0 [PT,L,QSA] 

注意,尾隨/上RewriteBase是必需的。