We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24277
    • 6 Posts
    Hi, first poster here.

    I’m having a problem with the modx install.
    the website is running fine, can make pages etc. but,

    if i create a link in a page to /Foto (a dir which has dir browsing on after a login which is working if directly addressed) the link is saved wrong.

    depends on which side of the network I am.
    If I’m on my internal network the link is: http://192.168.1.1:8082/Foto
    (because I’ve webserver running on port 8082 outside port 80 links to inside 8082)

    but when I connect externally and I want to click the link it still says: http://192.168.1.1:8082/Foto instead of: http://my.dns.com/Foto

    If I then edit the link externally again to /Foto and save the page, all is ok as long as I stay externally, but when I’m on my internal network again, and open the webserver and want to click the foto link it says: http://my.dns.com/Foto instead of: http://192.168.1.1:8082/Foto

    So my guess is that somehow the http_referer/hostname is somehow copied to links beginning with an / to the server.

    I don’t really know if it’s modx or php but I hope that someone can help me.


    Does anyone have a clue where to look?

    Thanks in advance !
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Is the page being cached? Any links generated will not change if that is the case.
        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
        • 24277
        • 6 Posts
        Hi, very late reply. sorry for that. (some work related problems.)

        yes. the page is being cached. but turning it of didn’t solve the problem.

        I tracked it down that in the head of the generated html output a base href exists. leading to each relative link substituted with the base href.

        I tried to get rid of the base href generated by the modx, but still no success.

        does anyone know how to eliminate this base href behaviour?

        TIA.

        Raas
          • 22303 MODX Staff
          • 10,725 Posts
          This is an issue of web server configuration. For Apache see the documentation of UseCanonicalName and ServerName directives for your version.
            • 24277
            • 6 Posts
            ok.. that makes sense.

            i’m running this website on a asus wl500gp router (running lighttpd with php 5.0 if that makes sense.), with usb support where an mysql db is installed...

            website runs without problems. though.. only this one.

            any clues?


              • 24277
              • 6 Posts
              Hi,

              I’m not using Apache webserver, but lighttpd webserver
              (if that’s also an ’apache’, sorry, I’m a real linux n00b)

              I’ve looked in the lighttpd configuration file (lighttpd.conf)
              and there’s no ’UseCanonicalName’ , a servername does exist, but was not set, I’ve set this to the name off the device.
              cleared the cache from modx,
              requested a page, but the base href still exists.. so servername did not solve the problem.

              Also I’ve looked in php.ini, but there is also no ’UseCanonicalName’ entry.


              Any ideas ?
                • 22303 MODX Staff
                • 10,725 Posts
                Sorry, I’ve never used lighttpd myself and know nothing about how it is configured, but there are several MODxers that run MODx on this web server. There’s even a friendly URL guide for lighttpd.

                Anyone know how to configure lighttpd to report the servername/http_host based on the URL you access the site with (i.e. similar to UseCanonicalName on Apache)? Or how to force requests to use a specific servername?
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  http://trac.lighttpd.net/trac/wiki/Docs

                  mod_rewrite and mod_redirect might be what’s needed. Or mod_setenv.
                    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
                    • 24277
                    • 6 Posts
                    Hi Sottwell,

                    thanks for your information,
                    I didn’t know exactly what you meant with your hints, so I looked them up in the config files and ’played’ with them..

                    the only result I got, was if I directly request a directoryname on the website (eg. /Foto) where directory browsing is on I got redirected to the homepage of /index.php again.. leaving my directories not accessible, so I changed this back to the original to prevent this behaviour.

                    One thing that I’m not sure off/don’t know is, What creates this base href tag ?
                    Is is Modxcms (most possible for me) or is it the webserver (lighttpd)

                    If i manually create an *.php page with some scripting (some ’Hello world’ examples I’ve found on the internet) in it and request this through the browser, no base href tab exists in the generated html
                    (I’m an M$ programmer myself and learning a bit about the linux/php/mysql environment, so a real n00b).

                    So at this point I don’t know exactly where to look at, webserver or modxcms.

                    (i’d like to know so I can make a write up on how to running this website on a 70$ box which uses a lot less energy than a normal pc...)


                    Thanks again !
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      MODx sets up the base_href in the file manager/includes/config.inc.php. If you look at the code there, it tries to dynamically determine the base path and the base href, based on environmental values returned from the server. So it’s possible (I’m not at all familiar with lighthttpd so I can’t really say any more) that there are some configuration issues to make your server return the expected values.

                      Or, you could hard-code the values in your site’s config.inc.php file. That just means that you would have to change that if you moved the site or made changes in your server.
                        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