MODX Temporary URLs

There are two ways to change a MODX Revolution website to use a temporary url, or changing it to the final url.

  1. Run the setup in upgrade mode
  2. Manually update the core config file

If you deleted the setup folder after installing MODX, then it may be faster to edit the config file than re-upload the installer and run it again. If you wish to update the config file, follow these steps:

  1. Locate the config file (Normally in /home/username/public_html/core/config/config.inc.php or alternatively /home/username/core/config/config.inc.php)
  2. Add or Remove the four username (/~username) references within the config file.
  3. Change the http_host name to the domain name used to access the website (without slashes) So http://domain.com or http://server.domain.com/~user/ would become domain.com and server.domain.com respectively.
  4. Manually delete the MODX Site Cache (the files in the core/cache folder), and visit the site using the new address.

If you have any problems making these adjustments, contact support for further assistance.

Example configuration for a MODX site running on a temporary URL

<?php
/**
 *  MODX Configuration file
 */
$database_type = 'mysql';
$database_server = 'localhost';
$database_user = 'database_user';
$database_password = 'yoursecurepassword';
$database_connection_charset = 'utf8';
$dbase = 'database_name';
$table_prefix = 'modx_';
$database_dsn = 'mysql:host=localhost;dbname=database_name;charset=utf8';
$config_options = array ();
$driver_options = array ();
$lastInstallTime = 1370383762;
$site_id = 'modx51ae6592bcd899.48905848';
$site_sessionname = 'SN4d0e76c39ccf4';
$https_port = '443';
$uuid = '263452b6-23f2-40a3-978d-174ce69a1890';
if (!defined('MODX_CORE_PATH')) {
    $modx_core_path= '/home/username/public_html/core/';
    define('MODX_CORE_PATH', $modx_core_path);
}
if (!defined('MODX_PROCESSORS_PATH')) {
    $modx_processors_path= '/home/username/public_html/core/model/modx/processors/';
    define('MODX_PROCESSORS_PATH', $modx_processors_path);
}
if (!defined('MODX_CONNECTORS_PATH')) {
    $modx_connectors_path= '/home/username/public_html/connectors/';
    $modx_connectors_url= '/~username/connectors/';
    define('MODX_CONNECTORS_PATH', $modx_connectors_path);
    define('MODX_CONNECTORS_URL', $modx_connectors_url);
}
if (!defined('MODX_MANAGER_PATH')) {
    $modx_manager_path= '/home/username/public_html/manager/';
    $modx_manager_url= '/~username/manager/';
    define('MODX_MANAGER_PATH', $modx_manager_path);
    define('MODX_MANAGER_URL', $modx_manager_url);
}
if (!defined('MODX_BASE_PATH')) {
    $modx_base_path= '/home/username/public_html/';
    $modx_base_url= '/~username/';
    define('MODX_BASE_PATH', $modx_base_path);
    define('MODX_BASE_URL', $modx_base_url);
}
if(defined('PHP_SAPI') && (PHP_SAPI == "cli" || PHP_SAPI == "embed")) {
    $isSecureRequest = false;
} else {
    $isSecureRequest = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
}
if (!defined('MODX_URL_SCHEME')) {
    $url_scheme=  $isSecureRequest ? 'https://' : 'http://';
    define('MODX_URL_SCHEME', $url_scheme);
}
if (!defined('MODX_HTTP_HOST')) {
    if(defined('PHP_SAPI') && (PHP_SAPI == "cli" || PHP_SAPI == "embed")) {
        $http_host='yourdomain.com';
        define('MODX_HTTP_HOST', $http_host);
    } else {
        $http_host= $_SERVER['HTTP_HOST'];
        if ($_SERVER['SERVER_PORT'] != 80) {
            $http_host= str_replace(':' . $_SERVER['SERVER_PORT'], '', $http_host); // remove port from HTTP_HOST
        }
        $http_host .= ($_SERVER['SERVER_PORT'] == 80 || $isSecureRequest) ? '' : ':' . $_SERVER['SERVER_PORT'];
        define('MODX_HTTP_HOST', $http_host);
    }
}
if (!defined('MODX_SITE_URL')) {
    $site_url= $url_scheme . $http_host . MODX_BASE_URL;
    define('MODX_SITE_URL', $site_url);
}
if (!defined('MODX_ASSETS_PATH')) {
    $modx_assets_path= '/home/username/public_html/assets/';
    $modx_assets_url= '/~username/assets/';
    define('MODX_ASSETS_PATH', $modx_assets_path);
    define('MODX_ASSETS_URL', $modx_assets_url);
}
if (!defined('MODX_LOG_LEVEL_FATAL')) {
    define('MODX_LOG_LEVEL_FATAL', 0);
    define('MODX_LOG_LEVEL_ERROR', 1);
    define('MODX_LOG_LEVEL_WARN', 2);
    define('MODX_LOG_LEVEL_INFO', 3);
    define('MODX_LOG_LEVEL_DEBUG', 4);
}
if (!defined('MODX_CACHE_DISABLED')) {
    $modx_cache_disabled= false;
    define('MODX_CACHE_DISABLED', $modx_cache_disabled);
}
  • Scripts, MODX
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Enabling gzip

Our servers support mod_deflate (gzip) which compresses files before sending them to the visitor....

Changing your WordPress Password

WordPress is a popular blogging tool, and a common target for hackers. It's important change your...