we have a wordpress site that has been blocked in some countries in Middle East. so we bought a new domain and pointed it to the same root folder. the homepage is showing with the new domain but all the pictures, external codes, and link are blocked due to the fact that they are referring to the first domain.
so, in short, what i want is:
-
when a user visits: [www.firstdomain.com] i want the contents of the page are all referring to the same domain, like [www.firstdomain.com/articles/1253/]
-
but when a user visits: [www.seconddomain.com] i want the contents of the page are referring to the second domain, like [www.seconddomain.com/articles/1253]
is that possible using wordpress alone? or should i install a caching script in the second domain?
It is rather easy to make WP think it is served from different domain by defining
WP_HOME
andWP_SITEURL
constants in configuration dynamically for request. See Editing wp-config.php in Codex for details.However this only affects dynamically generated elements. Everything that is part of content isn’t modified by this, including but not limited to content of posts.
Depending on your setup (server, caching, etc) it might be approached on different levels — from filtering inside WordPress to buffering and rewriting page on PHP level, and so on.