WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a bit lost on how to handle this redirect requirement.

So far I have:

  • www.domain-B.com parked on www.domain-A.com
  • So, requests for www.domain-B.com/page1 resolve to www.domain-A.com/page1 and so on
  • So far so good

However I would like one exception to this:

  • If user requests the root of www.domain-B.com, I would like them to go to www.domain-A.com/pageX

So everything works as normal with a parked domain except when a user goes to the root url of the parked domain.

I've tried the redirect plugin for WP but when redirecting www.domain-B.com to www.domain-A.com/pageX it actually redirects www.domain-A.com to that page as well. (because its properly parked I guess!)

Thanks in advance for any advice.

share|improve this question

Hi @user2924:

Use the 'template_redirect' hook; put the following in your theme's 'functions.php' file:

add_action( 'template_redirect', 'yoursite_template_redirect' );
function yoursite_template_redirect() {
  if (strtolower($_SERVER['HTTP_HOST'])=='www.domain-b.com')
share|improve this answer
Thank you very much Mike, appreciate the help! – user2924 Mar 3 '11 at 22:06
@user2924 - Did it work for you? Also since you are a new user be sure to follow up, see: wordpress.stackexchange.com/faq#howtoask – MikeSchinkel Mar 3 '11 at 22:13
OK, looked like it was working but I hadn't un-istalled the plugin. So now with no redirect plugins and the code above it does not work for me. It is as if WP does not know the request is coming from domain-b as it just sits on the regular home page. Ideas? – user2924 Mar 3 '11 at 22:25
@user2924 - Doh! I forgot to add exit;. :-) – MikeSchinkel Mar 3 '11 at 22:40
:-) Unfortunately it either results in a blank page, or if I try alternative url formats in the function i.e. (www.doma...) (domain...) (domain....) I either get an error where the URL parsed is too long or taken to the WP admin page, not the specified redirect page....hmmmm – user2924 Mar 3 '11 at 22:52

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.