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 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败