需要在 Kohana 中重写移动控制器
我正在尝试将 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]
I am trying to rewrite in htaccess
mobile.domain.com/mobile/function
into mobile.domain.com/function
I thought the below would work but it thinks that the function is a controller.
# 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]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
与
编辑交换:
好的,尝试这个而不是你当前拥有的:
Try swapping
with
EDIT:
Okay, try this instead of what you currently have: