As already mentioned by Shashi Mulugu you have to consider that the page is cached. You should make any assumption on rendering about the domain name via which the page is requested. Instead you can derive from the location of the resources you are rendering in which context this rendering operation happens.
That means, that in general you should reflect this difference in behavior into the resource tree, so you don't need to make any hardcode any decision, but instead make it depend on a property in a component or page. Then you can allow the business user (author) to change that behavior. In more complex cases you could implement inheritance of such a setting.
But hardcoding behavior based on domain names is a bad design. Because at that point you should think of not only production environments, but also many test environments.