> Zencart中文手册 > 修改zencart配置文件,使其适应不同域名解析

在includes/configure.php文件头部注释下面添加

$severname=preg_replace(’/(www.)|(..+)/’,”,$_SERVER['SERVER_NAME']);     //添加正则表达式去掉域名中”.”号的前面部分和”.”号的后面部分如:www.waimaole.com   去掉后变成waimaole
define(’HTTP_SERVER’, ‘http://’ . $_SERVER['SERVER_NAME']);              //获取域名名称
define(’HTTPS_SERVER’, ‘https://’ . $_SERVER['SERVER_NAME']);          //获取域名名称

修改后的文件为:

<?php


// Define the webserver and path parameters
// HTTP_SERVER is your Main webserver: eg-http://www.your_DOMain.com
// HTTPS_SERVER is your Secure webserver: eg-https://www.your_domain.com
$severname=preg_replace(’/(www.)|(..+)/’,”,$_SERVER['SERVER_NAME']);
define(’HTTP_SERVER’, ‘http://’ . $_SERVER['SERVER_NAME']);
define(’HTTPS_SERVER’, ‘https://’ . $_SERVER['SERVER_NAME']);

// Use secure webserver for checkout procedure?
define(’ENABLE_SSL’, ‘false’);

// NOTE: be sure to leave the trailing ‘/’ at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
// these paths are relative to top of your webspace … (ie: under the public_HTML or httpdocs folder)
define(’DIR_WS_CATALOG’, ‘/’);
define(’DIR_WS_HTTPS_CATALOG’, ‘/’);

define(’DIR_WS_IMAGES’, ‘images/’);
define(’DIR_WS_INCLUDES’, ‘includes/’);
define(’DIR_WS_FUNCTIONS’, DIR_WS_INCLUDES . ‘functions/’);
define(’DIR_WS_CLASSES’, DIR_WS_INCLUDES . ‘classes/’);
define(’DIR_WS_MODULES’, DIR_WS_INCLUDES . ‘modules/’);
define(’DIR_WS_LANGUAGES’, DIR_WS_INCLUDES . ‘languages/’);
define(’DIR_WS_DOWNLOAD_PUBLIC’, DIR_WS_CATALOG . ‘pub/’);
define(’DIR_WS_TEMPLATES’, DIR_WS_INCLUDES . ‘templates/’);

define(’DIR_WS_PHPBB’, ‘/’);

// * DIR_FS_* = Filesystem directories (local/physical)
//the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
define(’DIR_FS_CATALOG’, ‘/vhost3/’.$severname.’.com/’);      //网站存放的地址

define(’DIR_FS_DOWNLOAD’, DIR_FS_CATALOG . ‘download/’);
define(’DIR_FS_DOWNLOAD_PUBLIC’, DIR_FS_CATALOG . ‘pub/’);
define(’DIR_WS_UPLOADS’, DIR_WS_IMAGES . ‘uploads/’);
define(’DIR_FS_UPLOADS’, DIR_FS_CATALOG . DIR_WS_UPLOADS);
define(’DIR_FS_EMAIL_TEMPLATES’, DIR_FS_CATALOG . ‘email/’);

// define our database connection
define(’DB_TYPE’, ‘mysql’);
define(’DB_PREFIX’, ‘zen_’);
define(’DB_SERVER’, ‘localhost’);
define(’DB_SERVER_USERNAME’, ‘mysql用户名’);
define(’DB_SERVER_PASSWORD’, ‘mysql密码’);
define(’DB_DATABASE’, $severname);   //以正则表达式截取后的域名为数据名称
define(’USE_PCONNECT’, ‘false’);
define(’STORE_sessionS’, ‘db’);
// for STORE_SESSIONS, use ‘db’ for best support, or ” for file-based storage

// The next 2 “defines” are for SQL cache support.
// For SQL_CACHE_METHOD, you can select from:  none, database, or file
// If you choose “file”, then you need to set the DIR_FS_SQL_CACHE to a directory where your Apache
// or webserver user has write privileges (chmod 666 or 777). We recommend using the “cache” folder inside the Zen Cart folder
// ie: /path/to/your/webspace/public_html/zen/cache   — leave no trailing slash
define(’SQL_CACHE_METHOD’, ‘file’);
define(’DIR_FS_SQL_CACHE’, ‘/vhost3/’.$severname.’.com/cache’);          //网站存放的地址

// EOF