多域主页的CodeIgniter配置


CodeIgniter configuration for multi domain home

我已经构建了一个CI应用程序,最近刚刚被告知它必须是多主页的。也就是说,它将位于具有2个NIC的服务器上。一个用于www,另一个用于内部地址。

我不太确定应该在配置文件的base_url中使用什么值。从技术上讲,该网站的用户应该能够通过以下任一方式访问:

www.widgets.com-公共地址

http://ourserver.widgets.net-内部地址

如何配置我的CI应用程序以允许此操作?

谢谢。

./application/config/config.phpbase_url的配置修改为以下

/*
  |--------------------------------------------------------------------------
  | Base Site URL
  |--------------------------------------------------------------------------
  |
  | URL to your CodeIgniter root. Typically this will be your base URL,
  | WITH a trailing slash:
  |
  | http://example.com/
  |
  | If this is not set then CodeIgniter will guess the protocol, domain and
  | path to your installation.
  |
 */
$config['base_url'] = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . '/';;

它接受具有httphttps协议的任何域widgets.comourserver.widgets.net。谢谢

$config['base_url'] = '';

CodeIgniter将自己计算出base_url