dtlh12053 2011-10-27 13:54
浏览 31
已采纳

重载CodeIgniter的base_url

I have 54 sites that have different URLS but use the exact same codeigniter system AND application folders (before you think I spam for a living, the reality is that we own/manage 54 properties that use the same website 'template' and differentiate content for each via the database and/or separate asset folders in the vhosts/httpdocs folders.)

I placed the system and application folders for CI_2.0.3 in the vhosts directory above the httpdocs folder for each domain and can hit it successfully from two test sites with each showing the CI Welcome screen.

However, I am concerned about the base URL. If one is www.campuslodge.com and another is campuscreek.com, how do I handle that in a single config/config.php file? I can pass the property number to the application via the index.php file that exists in each of the 54 domain httpdocs folders, so can I also declare a global there for base_url and leave the one in config/config.php blank??? Or should I do something else???

Bottom line is that I need 54 unique domains to point to a single CI installation of both system and application so that I can make global changes once rather than 54 times.

  • 写回答

2条回答 默认 最新

  • dongqiao0953 2011-10-27 14:25
    关注

    you answered your question. Define a constant in each index.php, say:

    define('_MY_BASE_URL', 'http://yourdoamin.com');
    

    and in the config.php do:

    $config['base_url'] = _MY_BASE_URL;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM