We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39666
    • 29 Posts
    Hi,
    I have made a copy of a modx site on my local server (xampp installed) for convenience when working with tests.

    Everything seems to work fine after config.core and config.inc modifications, except the urls of the gallery images. The problem is with the slash that precedes the url of the images.

    For example:
    on the uploaded site:
    with
    <base href = "https://mydomain.com/">

    this works:
    <img src = "/ assets / images / myimage.jpg" />

    And this too:
    <img src = "assets / images / myimage.jpg" />


    But in my local site
    with
    <base href = "http://localhost/mysite/">

    this don't work:
    <img src = "/ assets / images / myimage.jpg" />

    but this yes:
    <img src = " assets / images / myimage.jpg" />


    I suppose this is due to some apache configuration, but...

    some idea?


    Thanks!
      www.abelmartinez.net
      • 39666
      • 29 Posts
      My config:
      if (!defined('MODX_CORE_PATH')) {
          $modx_core_path= 'F:/XAMPP/htdocs/mysite/core/';
          define('MODX_CORE_PATH', $modx_core_path);
      }
      if (!defined('MODX_PROCESSORS_PATH')) {
          $modx_processors_path= 'F:/XAMPP/htdocs/mysite/core/model/modx/processors/';
          define('MODX_PROCESSORS_PATH', $modx_processors_path);
      }
      if (!defined('MODX_CONNECTORS_PATH')) {
          $modx_connectors_path= 'F:/XAMPP/htdocs/mysite/connectors/';
          $modx_connectors_url= '/mysite/connectors/';
          define('MODX_CONNECTORS_PATH', $modx_connectors_path);
          define('MODX_CONNECTORS_URL', $modx_connectors_url);
      }
      if (!defined('MODX_MANAGER_PATH')) {
          $modx_manager_path= 'F:/XAMPP/htdocs/mysite/manager/';
          $modx_manager_url= '/mysite/manager/';
          define('MODX_MANAGER_PATH', $modx_manager_path);
          define('MODX_MANAGER_URL', $modx_manager_url);
      }
      if (!defined('MODX_BASE_PATH')) {
          $modx_base_path= 'F:/XAMPP/htdocs/mysite/';
          $modx_base_url= '/mysite/';
          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='abelmartinez.net';
              define('MODX_HTTP_HOST', $http_host);
          } else {
              $http_host= array_key_exists('HTTP_HOST', $_SERVER) ? htmlspecialchars($_SERVER['HTTP_HOST'], ENT_QUOTES) : 'localhost/am';
              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= 'F:/XAMPP/htdocs/mysite/assets/';
          $modx_assets_url= '/mysite/assets/';
          define('MODX_ASSETS_PATH', $modx_assets_path);
          define('MODX_ASSETS_URL', $modx_assets_url);
      }
      [ed. note: abramco last edited this post 5 years, 7 months ago.]
        www.abelmartinez.net
        • 39666
        • 29 Posts
        And config.core:

        define('MODX_CORE_PATH', 'F:/XAMPP/htdocs/mysite/core/');
        define('MODX_CONFIG_KEY', 'config');
          www.abelmartinez.net
          • 38783
          • 571 Posts
          Is it anything to do with http vs https?
            If I help you out on these forums I would be very grateful if you would consider rating me on Trustpilot: https://uk.trustpilot.com/review/andytough.com

            email: [email protected] | website: https://andytough.com
            • 39666
            • 29 Posts
            Quote from: andytough at Sep 03, 2018, 05:47 PM
            Is it anything to do with http vs https?

            I don't think so.


            I'm not an expert on apache, but I think the slash always sends to the root directory (loclahost), even if RewriteBase / mysite / is specified in the .htaccess of mysite folder.

            I will try creating a virtualhost.
              www.abelmartinez.net