【发布时间】:2011-12-30 10:19:55
【问题描述】:
我正在使用 HMVC 在 codeigniter 中开发网站。我将有多个指向 HMVC 模块的子域。 我当前的 .htacess 包含
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)
http://m.mysite.com/controller/method
万一类型
http://m.mysite.com/mobile_module/controller/method
我也想要
http://m.mysite.com/controller/method
如何在 .htaccess 中执行此操作?
【问题讨论】:
-
如果你想重定向到 m.mysite.com/.... 首先你必须创建一个子域
-
嗯,对我来说,您的实际问题似乎与 codeigniter 或 hmvc 无关,只是与如何编写 .htaccess 文件有关,对吧?如果是,请正确标记
标签: php .htaccess codeigniter module hmvc