views:

33

answers:

3

It seems to be a 'feature' of WordPress that it's designed to run on one, and only one host name.

The 'siteurl' and 'home' parameters are hardwired into the database options table, so if you hit the site on non-matching hostname you get redirected by PHP to the correct hostname. Even more irritatingly, the siteurl is prefixed to all internal links that are output to HTML. (although, perhaps that's the theme's fault - I haven't looked at that yet)

Is there a proper way to run WordPress on multiple domains without hacking the core, and without maintaining multiple options tables?

A: 

You do not need to maintain multiple options table. If nothing works try the following hack. The Host: parameter can be used as a simple and quick hack. Here is how:

  • Host all domains on one webserver.
  • Make root dir of all same for all.
  • hack the WP code and setting to modify site-url property and dynamically return $_REQUEST['Host']/wp-directory-path/.

Here is the request headers. The first line say it's a GET request for the /pub/WWW path and second line instructs for which domains it is. Host field is mandatory since HTTP/1.1

GET /pub/WWW/ HTTP/1.1
Host: www.w3.org
Ankit Jain
thanks, but I did ask for method that doesn't hack the core. This makes upgrading WP a pain.
Tim Whitlock
+1  A: 

I think the proper way is to enable multi-site operation, which is a feature of WP3.0.

kevtrout
This is the new way to do WPMU. As I understand it, it is multiple blogs on multiple domains, i.e. different content. I want the same blog on multiple domains.
Tim Whitlock
+1  A: 

There's an old plugin called Domain Mirror which seems to do what you want. Not sure if it works at all with WordPress 3+, but at the very least the same principles should be sound enough that you can look in the source code and adapt it for your functions.php.

Simon Scarfe
thanks. It looks like they are yet to support WP3. I shall check out what hooks they are using and probably roll my own.
Tim Whitlock