CodeIgniter模块到子域 [英] CodeIgniter Modules to Sub Domains
本文介绍了CodeIgniter模块到子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用HMVC开发codeigniter网站。我将有多个子域指向HMVC模块。
我当前的.htacess包含
I am developing the website in codeigniter with HMVC. I will have multiple subdomains which points to HMVC modules. My current .htacess contains
DirectoryIndex index.php
RewriteEngine On
RewriteCond $1 !^(index\.php|themes|assets|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
文件结构
./application
/modules
/news_module
/mobile_module
/api_module
./system/
键入
http://mysite.com/news_module/controller/method
http://mysite.com/mobile_module/controller/method
http://mysite.com/api_module/controller/method
但我想重新导向来自
http://mysite.com/mobile_module/controller/method
到
http://m.mysite.com/mobile_module/controller/method
并最后隐藏(mobile_module)
and hide (mobile_module) so finally
http://m.mysite.com/controller/method
如果sombody类型
In case sombody type
http://m.mysite.com/mobile_module/controller/method
也想要
http://m.mysite.com/controller/method
我如何在.htaccess中做这个?
how can i do this in .htaccess?
推荐答案
您的问题的第一部分使用:
for the first part of your question use:
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^mobile_module/(.*) http://m.example.com/$1 [R=301,L]
mysite.com/mobile_module/ _ __ _ ___
Don't see how someone would just type m.mysite.com/mobile_module/_______
这篇关于CodeIgniter模块到子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文