We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20576
    • 5 Posts
    Could someone point me to where this is set? Thanks, Marie
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      it’s dynamically generated by the config.inc.php file, in the manager/includes folder.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 20576
        • 5 Posts
        Thanks much.
          • 25883
          • 128 Posts
          s9consulting Reply #4, 18 years ago
          Is there a way to manually set the site url?

          I’m operating on a temporary domain and I think hardcoding the url might solve some issues I’m experiencing.

          If you reply please throw me an example or let me know exactly what code to replace --- I’m not too experienced with pHp so I don’t know too much about what I’m looking at.

          Thanks!

          John
            • 25883
            • 128 Posts
            s9consulting Reply #5, 18 years ago
            Thanks. I’m still working on a couple issues and this is becoming less important as I make headway...
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Yes, you can hand-code the site url in config.inc.php (where it’s dynamically calculated), but it would be much better to simply use a chunk.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 25883
                • 128 Posts
                s9consulting Reply #7, 18 years ago
                Susan, I’m making an educated guess that the text I should remove is whats in red.

                <?php
                /**
                * MODx Configuration file
                */
                $database_type = ’mysql’;
                $database_server = ’localhost’;
                $database_user = ’modx’;
                $database_password = ’password’;
                $database_connection_charset = ’’;
                $dbase = ’`mm_modx`’;
                $table_prefix = ’modx_’;
                error_reporting(E_ALL & ~E_NOTICE);

                $lastInstallTime = 1222825824;

                $site_sessionname = ’SN48e2d75fbccf0’;
                $https_port = ’443’;


                // automatically assign base_path and base_url
                if(empty($base_path)||empty($base_url)||$_REQUEST[’base_path’]||$_REQUEST[’base_url’]) {
                $sapi= ’undefined’;
                if (!strstr($_SERVER[’PHP_SELF’], $_SERVER[’SCRIPT_NAME’]) && ($sapi= @ php_sapi_name()) == ’cgi’) {
                $script_name= $_SERVER[’PHP_SELF’];
                } else {
                $script_name= $_SERVER[’SCRIPT_NAME’];
                }
                $a= explode("/manager", str_replace("\\", "/", dirname($script_name)));
                if (count($a) > 1)
                array_pop($a);
                $url= implode("manager", $a);
                reset($a);
                $a= explode("manager", str_replace("\\", "/", dirname(__FILE__)));
                if (count($a) > 1)
                array_pop($a);
                $pth= implode("manager", $a);
                unset ($a);
                $base_url= $url . (substr($url, -1) != "/" ? "/" : "");
                $base_path= $pth . (substr($pth, -1) != "/" && substr($pth, -1) != "\\" ? "/" : "");
                // assign site_url
                $site_url= ((isset ($_SERVER[’HTTPS’]) && strtolower($_SERVER[’HTTPS’]) == ’on’) || $_SERVER[’SERVER_PORT’] == $https_port) ? ’https://’ : ’http://’;
                $site_url .= $_SERVER[’HTTP_HOST’];
                if ($_SERVER[’SERVER_PORT’] != 80)
                $site_url= str_replace(’:’ . $_SERVER[’SERVER_PORT’], ’’, $site_url); // remove port from HTTP_HOST
                $site_url .= ($_SERVER[’SERVER_PORT’] == 80 || (isset ($_SERVER[’HTTPS’]) && strtolower($_SERVER[’HTTPS’]) == ’on’) || $_SERVER[’SERVER_PORT’] == $https_port) ? ’’ : ’:’ . $_SERVER[’SERVER_PORT’];
                $site_url .= $base_url;
                }

                if (!defined(’MODX_BASE_PATH’)) define(’MODX_BASE_PATH’, $base_path);
                if (!defined(’MODX_BASE_URL’)) define(’MODX_BASE_URL’, $base_url);
                if (!defined(’MODX_SITE_URL’)) define(’MODX_SITE_URL’, $site_url);
                if (!defined(’MODX_MANAGER_PATH’)) define(’MODX_MANAGER_PATH’, $base_path.’manager/’);
                if (!defined(’MODX_MANAGER_URL’)) define(’MODX_MANAGER_URL’, $site_url.’manager/’);

                // start cms session
                if(!function_exists(’startCMSSession’)) {
                function startCMSSession(){
                global $site_sessionname;
                session_name($site_sessionname);
                session_start();
                $cookieExpiration= 0;
                if (isset ($_SESSION[’mgrValidated’]) || isset ($_SESSION[’webValidated’])) {
                $contextKey= isset ($_SESSION[’mgrValidated’]) ? ’mgr’ : ’web’;
                if (isset ($_SESSION[’modx.’ . $contextKey . ’.session.cookie.lifetime’]) && is_numeric($_SESSION[’modx.’ . $contextKey . ’.session.cookie.lifetime’])) {
                $cookieLifetime= intval($_SESSION[’modx.’ . $contextKey . ’.session.cookie.lifetime’]);
                }
                if ($cookieLifetime) {
                $cookieExpiration= time() + $cookieLifetime;
                }
                if (!isset($_SESSION[’modx.session.created.time’])) {
                $_SESSION[’modx.session.created.time’] = time();
                }
                }
                setcookie(session_name(), session_id(), $cookieExpiration, MODX_BASE_URL);
                }
                }
                ?>





                I need an example of how to write the replacement code. What’s the syntax to replace it with?

                I replaced that whole block of red code with this:

                $base_url = ’http://www.domain.com/’
                $site_url = ’http://www.domain.com/’
                $base_path = ’http://www.domain.com/’

                and got major errors.

                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  $base_path needs to be the path, not a URL. Like "/home/myname/public_html/" or whatever your server uses for its structure.

                  I never remove code like that, I just comment it out.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 7231
                    • 4,205 Posts
                    I wonder what problems you cold be having that are caused by the site_url setting? It is normal to work on a temporary domain during development, so chances are someone has either experienced the same problem or maybe you are overlooking something. I would see if there is a solution that does not require editing any core code.

                    If you must edit the code: You would need to set the vars before they the DEFINE, that is what is causing the errors. The way you have it the vars are defined as empty and all sorts of stuff will fail.
                      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                      Something is happening here, but you don&#39;t know what it is.
                      Do you, Mr. Jones? - [bob dylan]
                      • 25883
                      • 128 Posts
                      What’s interesting is that MODx has kept the subfolder of the domain:

                      My original dev site address was something like http://0.0.0.0/~username

                      And MODx now thinks the siteURL is http://domain.com/~username/ and the baseURL as /~username/

                      That’s why I’m looking into editing the code to get rid of that /~username/ on the siteURL.