<![CDATA[ Incorrect TLD appearing in $base_url - My Forums]]> https://forums.modx.com/thread/?thread=85230 <![CDATA[Re: Incorrect TLD appearing in $base_url]]> https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-539732
i found another thread yesterday & replied to it. it's on this same issue...
https://forums.modx.com/thread/99559/website-with-multiple-domains-same-content-different-logo#dis-post-539731
]]>
syberknight Mar 17, 2016, 01:09 PM https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-539732
<![CDATA[Re: Incorrect TLD appearing in $base_url]]> https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-539730 Quote from: sottwell at Jun 26, 2013, 07:27 PM
The site_url is calculated from the $_SERVER[HTTP-HOST] in the config.inc.php file on each page request. Of course, your page will get cached with the value used for the first request of the page, which is why calling it uncached will get the actual value calculated for that page request.

I have "parked" domains pointing to my main domain, and sometimes one of the parked domains gets requested. So I have used .htaccess rewrite rules to rewrite anything with those parked domains into my main domain. That way by the time MODx sees the page request, it's been rewritten so all MODx ever gets it my main domain.

Sometimes web servers are configured in such a way that these $_SERVER values aren't really reliable. You can always set a context setting for the "web" context with the site_url that you want.

hi sottwell,

i, just yesterday, started experiencing this phenomena - where my base href site_url would change to one of our parked/alias domains, & thusly breaking the linked-to font & js libraries. it really concerned me as 1) i don't understand these things, & 2) apparently my host is undergoing a big DDS attack or something. so i was scared i got hacked.

but from what i'm reading, it's a fairly common thing to have happen. i HAVE double-checked all my config.inc.php files & htaccess - all seems to be in order.

i will implement the exclamation point to uncache the call & hope that helps. but after reading your post here, i have a couple questions, i f you don't mind...

1) what would change about a server that would suddenly cause this to happen?

2) can you share these "htaccess rewrite rules" you speak of please?

3) and, is it possible to, if i point a different domain i have to a specific directory, to have pages shown from that directory to use this domain in the field of the browsers, then when clicking on a link to a different directory, or even the homepage, switch back to the main domain - all the while sharing the same resources, css/js/etc???
if so, how? but i suspect you're gonna say 'no'.

THANKS!!!]]>
syberknight Mar 17, 2016, 01:03 PM https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-539730
<![CDATA[Re: Incorrect TLD appearing in $base_url]]> https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-470095 ]]> py-cal Jun 26, 2013, 02:29 PM https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-470095 <![CDATA[Re: Incorrect TLD appearing in $base_url]]> https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-470093
I have "parked" domains pointing to my main domain, and sometimes one of the parked domains gets requested. So I have used .htaccess rewrite rules to rewrite anything with those parked domains into my main domain. That way by the time MODx sees the page request, it's been rewritten so all MODx ever gets it my main domain.

Sometimes web servers are configured in such a way that these $_SERVER values aren't really reliable. You can always set a context setting for the "web" context with the site_url that you want.]]>
sottwell Jun 26, 2013, 02:27 PM https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-470093
<![CDATA[Re: Incorrect TLD appearing in $base_url]]> https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-470087
<base href="http://[[env?variable=SERVER_NAME]]/" />

...and I am trying to anticipate why an environment variable was used here instead of just hard-coding the URL. Any idea?

And I'm pretty comfortable configuring a web server now, but I can't guess what you might be pointing to - what do you propose?

]]>
py-cal Jun 26, 2013, 02:12 PM https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-470087
<![CDATA[Re: Incorrect TLD appearing in $base_url]]> https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-470082
<base href="[[++site_url]]">


You can resolve your cached site_url issue by changing it to...
<base href="[[!++site_url]]">


Or you can make sure your site is only accessible from the appropriate domains via your web server configuration.]]>
opengeek Jun 26, 2013, 01:55 PM https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-470082
<![CDATA[Incorrect TLD appearing in $base_url]]> https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-470080
This has happened twice now in as many weeks, and it occurred on a different set of pages than it did last time.

Now I'm not sure if this is related, but I was experiencing problems with localization of sidebar widgets - depending on what was cached first, the widget would always be in that language. When broken, my template invoked things this way:

[[$Head]]

[[Web_Contact_Map]]

And when I changed it to the below, things started working as expected:

[[!$Head?]]

[[!Web_Contact_Map?]]]]>
py-cal Jun 26, 2013, 01:28 PM https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-470080