Server Fault is a question and answer site for system and network 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 want to setup a single wordpress install to allow users to visit using 2 domains:

For example:

I can do this for the most part, but whatever domain is configured in the wp-admin screen, it will redirect to that whenever any of the links are clicked.

For example, if I set it up to and I come in using and click an article link, it takes me to and the article link. I want the user to stay on the domain they came in.

share|improve this question

migrated from Jan 1 '10 at 3:14

This question came from our site for professional and enthusiast programmers.

It depends. Do you want one domain to redirect to the other, or do you want the same content available on both domains?

For the former, just use a rewrite rule to permanently redirect the first domain to the second domain. It's important that you use a permanent redirect (301) or Google will penalize you for duplicate content:

RewriteCond %{HTTP_HOST} ^myfirstdomain\.com$
RewriteRule (.*)$1

The latter is much harder because WordPress expects a "main" domain for each blog, and it's not something you would want to do for SEO reasons because Google will see two pages that are exactly the same in two different spots.

You can map multiple domains to the same blog but WordPress will always redirect them to the primary domain.

You can proxy the requests from to (just don't map in WordPress):

RewriteCond %{HTTP_HOST} ^myfirstdomain\.com$ RewriteRule (.*)$1 [P,L]

I've never tried this so it might not work without problems. Either way, it's a really bad idea to do this for so many reasons.

share|improve this answer
latter, dont mind the seo hit. – Joelio Dec 31 '09 at 21:46
Formatting doesn't work in comments? That blows. Will repost in a separate answer. – Foofy Jan 1 '10 at 0:29
up vote 1 down vote accepted

Well, I tried rewriting above and it didnt work so well, but this seemed to work pretty well:

Go to plugins folder and create a file with this in it:

Plugin Name: Disable Canonical URL Redirection
Description: Disables the "Canonical URL Redirect" features of WordPress 2.3 and above.
Version: 1.0
Author: Mark Jaquith
Author URI:

remove_filter('template_redirect', 'redirect_canonical');


Enable the plugin, then wala, it works!

share|improve this answer

No coding necessary! Simple install and everything (domains and subdomains and different theme options per domain) are taken care of! Enjoy!

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.