We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8416
    • 173 Posts
    Hi
    I’m looking at a way to change the site_url value for the config setting based on the domain name entered as an URL.
    It seems to me that I could used a plugin to reset the site_url value on the event "OnWebPageInit" and then I should be able to include the plugin in my templates. Is it the right approach? Does anyone has encountered the same situation and/or has a plugin sample to share?
    Thanks a bunch for your help.

    Eric
      • 22303 MODX Staff
      • 10,725 Posts
      MODx should already do this based on the HTTP_HOST value reported by the server, so it also depends on your Apache (or other web server) configuration. The problem is going to be caching. In order to do this, you have to make sure that nothing in your site gets cached with a full URL, or you’ll get all kinds of inconsistencies as people access and cache pages from different hosts. In particular, if using the base href tag recommended for MODx templates, you’ll need a way to prevent that from caching for sure.
        • 8416
        • 173 Posts
        Thanks for your reply.
        Is it ok to turn off the caching totally? Any performance impact? Thanks.