codeigniter 多个应用程序,带有通配符子域,mod_rewrite 将子域重新映射到 .php
我有一个 codeigniter 项目,结构如下:
httpdocs/
/application/
/ggg/
config/
controllers/
models/
libraries/
views/
...
/sgaz/
config/
controllers/
models/
libraries/
views/
...
/index/
config/
controllers/
models/
libraries/
views/
...
/system/
index.php
我正在尝试重新编写一个通配符子域以映射到其各自的应用程序。只是不知道如何解决这个问题。
我知道您可以创建多个应用程序并为每个应用程序使用多个 (.*).php 文件(即:ggg.php、sgaz.php、index.php)。但是是否可以有一个单独的index.php 文件并使用mod_rewrite 将调用从子域重定向到其各自的应用程序环境? IE: http://ggg.mapitusa.com/user/login 重定向(不带 htaccess)到http://mapitusa.com/index.php/ggg/user/login ?
谢谢!
I have a codeigniter project structured as so:
httpdocs/
/application/
/ggg/
config/
controllers/
models/
libraries/
views/
...
/sgaz/
config/
controllers/
models/
libraries/
views/
...
/index/
config/
controllers/
models/
libraries/
views/
...
/system/
index.php
I am trying to re write a wildcard sub domain to map to its respective application.. Just not sure how to go about this.
I know you can create multiple applications and use multiple (.*).php files for each application (IE: ggg.php, sgaz.php, index.php). But Is it possible have a single index.php file and use mod_rewrite to redirect calls from a sub domain to its respective application env? IE: http://ggg.mapitusa.com/user/login redirects (without htaccess) to http://mapitusa.com/index.php/ggg/user/login?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将以下内容添加到站点根目录中的
.htaccess
文件中。如果您希望地址栏中的 URL 更改为
http://mapitusa.com/index.php/ggg/user/login?
,请将上面的 RewriteRule 替换为Try adding the following to the
.htaccess
file in the root directory of your site.If you want the URL in the address bar to change to
http://mapitusa.com/index.php/ggg/user/login?
, replace the RewriteRule above with