.htaccess 需要为科哈纳的移动控制器重写

.htaccess 需要为科哈纳的移动控制器重写,.htaccess,kohana,rewrite,.htaccess,Kohana,Rewrite,我正试图用htaccess重写 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 .*> Ord

我正试图用htaccess重写

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]
#启用URL重写
重新启动发动机
#安装目录
重写基/
#保护隐藏文件不被查看
命令拒绝,允许
全盘否定
#保护应用程序和系统文件不被查看
重写规则^(?:应用程序|模块|系统)\b.*index.php/$0[L]
#允许直接显示现有的任何文件或目录
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#将所有其他URL重写为index.php/URL
重写规则。*index.php/$0[PT]
#为手机重写
RewriteCond%{HTTP_HOST}^mobile\.domain\.com$[NC]
重写cond%{REQUEST_URI}!移动设备[NC]
重写cond%{REQUEST_FILENAME}-F
重写规则^(.*)$/mobile/$1[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]


编辑:

好的,试试这个,而不是你现在拥有的:

# 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]
#启用URL重写
重新启动发动机
#安装目录
重写基/
#保护隐藏文件不被查看
命令拒绝,允许
全盘否定
#保护应用程序和系统文件不被查看
重写规则^(?:应用程序|模块|系统)\b.*index.php/$0[L]
#允许直接显示现有的任何文件或目录
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#将所有其他URL重写为index.php/URL
重写规则。*index.php/$0[PT]
#为手机重写
RewriteCond%{HTTP_HOST}^mobile\.domain\.com$[NC]
重写cond%{REQUEST_URI}!移动设备[NC]
重写cond%{REQUEST_FILENAME}-F
重写规则^(\w+)$/mobile/$1
#允许直接显示现有的任何文件或目录
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#将所有其他URL重写为index.php/URL
重写规则。*index.php/$0[PT]
# 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]