Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to convert a freshly-installed and functional WordPress into a multisite network. But I'm having problems because of our Apache configuration.

We use Apache to randomly redirect requests for to one of two application servers: or The problem is that WordPress redirects to DOMAIN_CURRENT_SITE (defined in wp-config.php) if the current browser domain differs from that. This results in a 310 redirect loop. Here's an example of what happens:

  1. User requests
  2. Apache redirects to
  3. Because redirect domain does not match DOMAIN_CURRENT_SITE, WordPress redirects to DOMAIN_CURRENT_SITE (
  4. Return to step 1 and repeat

What I'd like to do is set all WordPress links and URLs to and have WordPress ignore the fact that or is actually being retrieved. Is this possible?

Here are the relevant Apache conf files (simplified), in case I'm not being quite clear:



RewriteMap server rnd:conf/application_servers.conf
RewriteRule ^/apps/*([^/]*)/*(.*) http://${}/apps/$1/$2 [P,L,QSA]
share|improve this question

1 Answer 1

up vote 1 down vote accepted

After banging my head on this for a few days, I found a solution that works.

Just add the following to wp-config.php:

if ( isset( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) {

This will force WordPress to use the requested domain, instead of the proxy domain.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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