2010-09-08 31 views
0

改寫爲移動控制器我試圖在htaccess的需要在Kohana中

mobile.domain.com/mobile/function改寫爲mobile.domain.com/function

我想下面的工作,但它認爲,功能的控制器。

# Turn on URL rewriting 
RewriteEngine On 

# Installation directory 
RewriteBase/

# Protect hidden files from being viewed 
<Files .*> 
Order Deny,Allow 
Deny From All 
</Files> 

# 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] 

# Rewrite for Mobile 
RewriteCond  %{HTTP_HOST} ^mobile\.domain\.com$ [NC] 
RewriteCond  %{REQUEST_URI} !mobile [NC] 
RewriteCond  %{REQUEST_FILENAME} !-f 
RewriteRule  ^(.*)$   /mobile/$1 [L] 

回答

2

試換

# 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] 

# Rewrite for Mobile 
RewriteCond  %{HTTP_HOST} ^mobile\.domain\.com$ [NC] 
RewriteCond  %{REQUEST_URI} !mobile [NC] 
RewriteCond  %{REQUEST_FILENAME} !-f 
RewriteRule  ^(.*)$   /mobile/$1 [L] 

編輯:

好了,試試什麼,而不是你現在有這樣的:

# Turn on URL rewriting 
RewriteEngine On 

# Installation directory 
RewriteBase/

# Protect hidden files from being viewed 
<Files .*> 
Order Deny,Allow 
Deny From All 
</Files> 

# 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] 

# Rewrite for Mobile 
RewriteCond  %{HTTP_HOST} ^mobile\.domain\.com$ [NC] 
RewriteCond  %{REQUEST_URI} !mobile [NC] 
RewriteCond  %{REQUEST_FILENAME} !-f 
RewriteRule  ^(\w+)$   /mobile/$1 


# 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] 
+0

這沒有效果 – kbrin80 2010-09-08 19:08:51

+0

@ kbrin80編輯,現在檢查。 – aularon 2010-09-08 19:18:32