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 a bit lost on how to handle this redirect requirement.

So far I have:

  • parked on
  • So, requests for resolve to and so on
  • So far so good

However I would like one exception to this:

  • If user requests the root of, I would like them to go to

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 to it actually redirects to that page as well. (because its properly parked I guess!)

Thanks in advance for any advice.

share|improve this question

1 Answer 1

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'])=='')
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: –  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.