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?

  • Is it the domain or the IP being blocked? I would suspect it's the latter, making circumvention more difficult. – Dan Mar 30 '14 at 18:11
  • Where is the domain hosted? Some places such as GoDaddy offer forwarding with "Masking", which may or may not also mask the resources that are loading. – Oturia Mar 30 '14 at 23:39
  • What got your site blocked? – Tom J Nowell Mar 30 '14 at 23:48
  • @Dan no it's just the domain, I opened the new domain in their server and it's working. – Alex C. Mar 31 '14 at 5:18
  • @TomJNowell It's an atheists network. – Alex C. Mar 31 '14 at 5:18

It is rather easy to make WP think it is served from different domain by defining WP_HOME and WP_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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.