Domain Mirror Plugin
Wordpress 2.5: DomainMirror seems to work with no changes on this version, as long as the 2.3 patch is in place.
Download: Domain Mirror v1.1
Download: Domain Mirror v1.2beta
Download: WP-DomainMirror WordPress 2.3 fix
If you have more than one domain and want to point both of them at the same WordPress installation, you’ll find that it doesn’t really work very well. Wordpress creates it’s own internal URLs based on the settings in General Options. This Plugin allows multiple domains to be configured within WordPress and updates the Weblog Title, WordPress Address URL and Blog Address URL on-the-fly based on the value of $_SERVER['SERVER_NAME'].
This allows one installation to show different URL paths, tagline and blog title for each domain.
What it won’t do is make one domain appear to be two, or change your domain configuration. You need to do that yourself, or have your hosting provider do it for you.
To see it in action, you can access this site via http://McAleavy.org or http://LightPainting.org. Both point to a single WordPress installation, running on a single database.
NB: It doesn’t appear to work with WordPress MU.
New in v1.1
- You can now have a separate tagline on each domain.
- The Admin screen has a button to copy in the current Wordpress configuration to save on typing.
- The Admin screen has buttons to clear content from whole domains and indivudual lines.
New in v1.2beta
This version is pretty new, contains quite a few changes, and may have bugs. Please use it if you’d like to help find them.
- Theme switching.
- SERVER_NAME / HTTP_HOST config option.
- “no admin screen” switch.
- More validation.
- Added “stripcslashes”
Installation
- Download and unpack the archive. If you downloaded the plugin from my site it will unpack to a directory named “AA-DomainMirror”, but if you got it from the Wordpress plugin repository it will unpack to the direcotory “domain-mirror”. Either will work, but you may need to rename the latter to “AA-DomainMirror” if you have problems with some other plugins not seeing the changes. See below.
- Copy the whole AA-DomainMirror directory to wp-content/plugins/ If possible, don’t change the name of the directory, as the AA- at the start is a horrible hack to ensure that Wordpress loads this plugin first. This is required as any plugin loaded before it won’t be able to see the changes it makes, so will behave as if it’s still on the default domain. This puzzled me for quite a while.
- Go to your Plugins page and activate Domain Mirror.
- Go to the Options -> Domain Mirror page and configure as outlined below.
Upgrade
Overwrite the old version with the new version.
Usage
When enabled, Domain Mirror will change the values of Weblog Title, Tagline, Wordpress Address and Blog Address automatically. Where you have hard-coded the site name or a site URL into a post or page you should replace that entry with one of the tags provided. See below.
Configuration
Click the images to expand.
You will need to set up at least 2 domains that point to the same WordPress install. With Apache you can do that with Virtual Hosts. If you are using a hosted account there may be some way to set this up through the account configuration screens. On the host I use for this site, DreamHost, you do this by logging into the Panel interface and selecting Domains >> Manage Domains. Your first domain must be Fully Hosted. For the Domain you want to set as the Mirror, click the edit button. In the edit screen there are 5 options:
- Fully Hosted;
- Redirected;
- Mirrored;
- Parked;
- Cloaked.
Select the Mirrored option, and set Domain to mirror to the name of your Fully Hosted domain. Shown here is this setting for my lightpainting.org domain, which mirrors mcaleavy.org.
Your existing Wordpress configuration should be left as it is. This will not be changed unless you press Save on this page when viewed from a domain other than the default. See below.
On initial activation, the Domain Mirror options screen will display a default blank entry. This default is defined in conf.inc.php - which can be edited to set different defaults. The post tags used to display the current setting of these fields in posts or pages are shown to the right. Add this text to a post or page and it will be replaced by it’s value for the current domain. This allows such posts to display properly from any configured domain.
Fill in the settings for the current domain, or press the Get Current Domain button to get the values from the database. This is recommended because the General Options page will show the Domain Mirror configured settings when accessed from another domain. If you then press Save on that page those options will be written to the Wordpress settings, overwriting the original settings. If you don’t have those settings in Domain Mirror, they will be lost and the original domain will not function properly until they are re-entered. If Save is not pressed, the original values will be retained and will be used again when the plugin is disabled.
Click the Save button to record the changes. The screen will reload and display the Changes Saved banner.
To add another domain, click the Add New Domain button. The page will refersh with a 2nd blank domain.
The General Options screen, when accessed from the new domain, now displays the details for that domain. These options, however, are coming from the Domain Mirror configuration and not from the Wordpress settings. As noted before, if save is pressed on this page these options will be written to the Wordpress settings, overwriting the original settings. If you don’t have those settings in Domain Mirror, they will be lost and the original domain will not function properly until they are re-entered.
To delete a domain, press the Delete Domain button and it will be removed from the page. This change will be written to the database when you next press Save Changes. If you delete all of the entries in Domain Mirror it will return to it’s default settings. If you wish to alter these defaults you can edit the file config.inc.php in the AA-DomainMirror directory. The “X” buttons on each line can be used to clear the contents of that line and the Clear All button can be used to clear the contents of that domain setting. Again, pressing Save Changes is rquired to make these changes permanent.
DaveMc, April 2007.










Entries (RSS)
June 4th, 2007 at 8:12 pm
[...] added the Andreas00 Theme, activatet the additional plugins and installed the Domain-Mirror Extension which I hope enables us to make a real jabber.fsinf.at blog with this wordpress farm (not [...]
June 5th, 2007 at 10:06 pm
I configured my two domaind (crkdesigners.com and bent101.com) as per your instructions but only the first domain (bent101.com) works! What am I missing? My WordPress is located as: http://www.bent101.com/wordpress
June 5th, 2007 at 10:39 pm
It looks like those two domains are pointing at different sites. You need to set both domains to point to the same site - the plugin will then see the incoming doamin name and change the Wordpress configuration. A “forward” from one domain to the other won’t work as Wordpress will still see an incoming connection to the original domain.
With my webhost (dreamhost.net) that’s done by setting up what they refer to as a “domain mirror”, but I suspect that this is simply setting the DNS on both domains to point to the same directory on the server. You can tell if you have that set up properly by looking at the “Current Domain” display in the Admin Page. This should be different when using the other domain.
Dave
June 6th, 2007 at 1:53 pm
I have a couple of questions.
1) so long as the sites share the same db (& are true file & .htaccess mirrors of each other), why would they need to live on the same server?
2) how difficult would this be to extend to having differing themes based upon domain? (My thoughts are to be able to have a much more robust version of MU WP… and being able to have a central control point for administration of simple sites based on WP that share content.)
June 6th, 2007 at 8:47 pm
Michael,
Yes, in theory I think this plugin would allow you to have 2 identical servers on 2 separate domains share same database. I’m not sure why you’d want to do that though as the net effect would be the same as pointing both domains at the same server, except you’d have 2 installs to upgrade and maintain. I’m also not sure if it’s safe to have 2 Wordpress installs access the same database at the same time. There’s a chance that they might cause some data corruption by stepping on each other’s writes. I don’t know enough about mySQL to be sure.
I’ve been thinking about the possibility of changing theme based on the domain. It depends on how much the configuration changes when the theme is swapped, and whether those options can be filtered. If they can it should be relatively straightforward. I’d was also considering having different sets of posts show on either site, but how practical that is I don’t yet know - it might be easier to just run 2 Wordpress installs for that.
The next version, running here, allows the tag line to be changed too, and upgrades the Admin page a bit. I’ll try and get that posted tonight sometime.
Dave
June 10th, 2007 at 9:30 am
Excellent plugin ! I tried to use it for the .mobi version of the website, but it’s not working. I’m using the Wordpress Mobile plugin by Andy Moore (http://www.andymoore.info/wordpress-mobile-plugin/).
Btw there is a bug Line 111, 115, 290 and 329 need to add a stripcslashes(). Just add a slash in the title or description to notice it.
June 10th, 2007 at 10:05 am
Hatem,
I suspect that Wordpress is probably loading the Mobile plugin before the Domain Mirror plugin. Do you have it installed in the directory “wp-content/AA-DomainMirror” or “wp-content/domian-mirror”? I had similar problems with Ultimate Tag Warrior that could only be resolved by changing the directory name as Wordpress loads plugins in alphabetical order. I’ll download that plugin and investigate, and add some stripslashes.
Thanks,
Dave
June 10th, 2007 at 10:18 am
I install it as it under domain-mirror, will try the AA- and see if it’s works. Thanks
June 15th, 2007 at 8:06 am
I got this plugin installed. I have few questions
1) Will this work for wordpress-mu-1.2.1?
2) I am using apache webserver that runs a site (default wordpress-mu) domain. Once i activate this plugin will the alternate domain will be directly accessible in browser or we should create virtual hosts in apache, in order to access this in browser?
Thought welcome.
Thanks
Naveen
June 15th, 2007 at 10:09 pm
Naveen,
I’m not sure how plugins work under Wordpress MU as I’ve never looked at it, so I’m not sure if an install of domain mirror would affect all users on the MU system or just those with it active. It depends on how MU handles filters. I suspect it will work, but I’ll try and give it a test and see what happens.
On the Apache configuration, the virtual host would need to point to the same directory as the main host if that can be done. I have a possible change that may make that setup work better - I’m currently looking a SERVER_NAME to determine the incoming URL, but it’s might be better to look at HTTP_HOST for instances where SERVER_NAME doesn’t change.
Dave
June 18th, 2007 at 7:22 am
Thanks for your response Dave
It was very helpful, even i will try and get back to you.
- Naveen
June 23rd, 2007 at 6:39 pm
I too am on DH and using a MU WP install, and I cant get the second domain (actually a subdomain) to work, even thought I’ve setup the second domain as mirror on DH panel.
June 23rd, 2007 at 6:51 pm
I’ve not yet done any testing with WordPress MU, so it may be an issue with that - what’s happening when you access WP from the other domain?
Dave
July 6th, 2007 at 6:43 am
[...] Visit [...]
July 10th, 2007 at 11:36 pm
Have a problem, huh. I made a new domain and uploaded a copy of the blog on it. Then uploaded your plugin. But when I went to activate the plugin, /wp-admin redirects to the main domain. In other words, I cannot access a new domain’s blog to activate your plugin.
The problem, of course, has nothing to do with your plugin, but I cannot figure out how to solve it. Any suggestions are welcome.
July 11th, 2007 at 9:20 am
ok, I finally manaed to install the plugin, but it only changes sidebar’ posts urls. Please look at http://www.samsonblinded.com/blog - most of the links did not convert.
Thanks,
Alex
July 11th, 2007 at 7:56 pm
Alex,
If it’s changing some URLs and not others it may be a plugin loading order issue - any plugin that loads before Domain Mirror will not see the modified values. I had a similar problem with Ultimate Tag Warrior on my sidebar. Where do you have the plugin installed?
It could also be some custom code that isn’t using the standard get_option() call to get the WordPress and Blog URLs. Have you done any customising?
Dave
July 11th, 2007 at 10:00 pm
Thanks for replying, Dave. There is a lot of customization, but with get_option. Even comments urls are not converted, though.
Alex
July 12th, 2007 at 1:22 pm
Alex,
If you let me know what versions of WordPress and Domain Mirror you’re using, and what theme, I’ll try and reproduce it. There’s a possibility that it might have something to do with the Apache variable being used to detect the incoming URL - 1.0 and 1.1 use SERVER_NAME, whereas that can be changed in the conf.inc.php in 1.2beta. Someone else discovered that HTTP_HOST works better in some configurations.
Dave
July 12th, 2007 at 4:47 pm
Thanks, Dave. I’m using a custom theme. Will follow your suggestion, upgrade to 1.2beta, will see.
Alexx
July 27th, 2007 at 4:38 am
Hi, i have wordpress on http://www.domain.com/wp ( /www/domain.com/htdocs/wp ) and i want to make it accessible under myname.com, this last domain, has to be an alias for domain.com, right? because i can also point it to the same location in the server file system (/www/domain.com/htdocs )
July 28th, 2007 at 8:30 am
Luis,
Yes. Set your webserver up to point both domain names to the same directory on the server. With Apache you can do this by setting up a Virtual Host.
Dave
August 3rd, 2007 at 3:42 pm
can u help me use the domain mirror, to show only a tag?
what should i do with the dmWpAddr and dmBlogAddr fields?
August 13th, 2007 at 10:06 am
The tags [ dmWpAddr ] and [ dmBlogAddress ] are used to insert the URL of the current site into a post.
For example, if you want to add a link to another static page on your blog to a post it’s usually best to do this with a full path (if you use a relative path the link sometimes won’t work from an archive page). If you do this you’ll want that path to change when the site is accessed from a 2nd domain, so the tags allow you to insert the Wordpress Address and the Blog Address dynamically into a posted URL.
[ dmWpAddr ]/wp-content/graphics/something.jpg
Dave
August 13th, 2007 at 10:15 am
Thanks
August 15th, 2007 at 3:11 am
my god this is perfect…..works perfect to. this really saves me thanks
August 19th, 2007 at 7:25 am
Sorry Dave, i don’t understand what is “mirror domain setting on your dreamhost. i have 5 parked domains at main one where WP installation is. All domains have DNS record pointing at the host. It doesn’t seems to work. What am i missing here?
August 19th, 2007 at 12:20 pm
Alex,
If you’re using DreamHost, then you need to change the configuration of your Parked domains to Mirrored. I’ve added a section to the Configuration instructions with a screen shot to show how this is done.
Dave
August 19th, 2007 at 2:37 pm
I am not using dream host, but my own host, there is no such thing as “mirror” domain. is there any way to make it work with regular cpanel?
August 22nd, 2007 at 12:57 pm
Alex,
I don’t have any experience with cpanel, so I don’t know if it allows the setup of additional domains as Virtual Hosts. If the parked domains are all pointing at the same directory, I would have expected that to work. If they’re just forwarding to your existing domain, it won’t, as the script won’t see a change to the incoming domain.
Dave
September 3rd, 2007 at 1:21 pm
The plugin (v1.2Beta) seems to be incompatible with WordPress 2.2.x and above. I tried to activate the plugin on my blog and it gave me an error > “Plugin not activated as it generated a fatal error” or something like it.
Can you tell me why is this happening?
I just downloaded the zip from your site and uploaded the AA-DomainMirror Directory to the plugins folder as per your instructions.
So please advise Dave.
Thanks
September 4th, 2007 at 8:50 pm
Fawaz,
Are you running a version later than 2.2.1? That’s what I’m running here, and so far I haven’t tried it on anything later. I’ll try the latest version and see how it goes.
Dave
September 16th, 2007 at 3:52 pm
this used to work so well for me and now it dont anymore. i dont remember having to go and forward domains like it says to now and i just cant get it to work
September 22nd, 2007 at 9:38 pm
[...] your first domain is. In conclusion, I thank him and you can find more info, download links on his blog or you can download it from my mirror (it’s the beta version) Add article [...]
September 25th, 2007 at 2:28 pm
Dave!
I really need your Plugin for WP2.3! Any plans to upgrade?
Many thanks
Peter Lurie
September 27th, 2007 at 12:31 am
What’s about Google Duplicate Content Filter ?!
September 30th, 2007 at 1:02 pm
I’ll be upgrading this site to WordPress 2.3 next week, so will deal with the plugin issues then and push out a new version. Sorry for the delay - I’ve been tied up with other things recently.
Google seems to be smart enough to recognise the difference between the same site on multiple domains and the same content on different sites - at least I’ve never had any problems. Both my domains see hits from Google, so don’t appear to be filtered.
Dave
October 1st, 2007 at 10:03 pm
Dave:
My problem is sort of the reverse. I have WP set up on a domain that I don’t want to expose. It powers four other domains.
We’re doing this right now with an old installation of ezPublish and want to kick over to the fantastic features of WP, which we’ve been working on for months.
So:
http://www.masterdomain.com hosts the admin software and is, in fact, the only “real” domain.
http://www.domain1.com
http://www.domain2.com
http://www.domain3.com and
http://www.domain4.com
Are all pointed at their respective home directories (www.masterdomain.com/domain1, etc).
This much, we can do in WP and .htaccess.
But our current installation of ezPub also rewrites the domain name so that
http://www.masterdomain.com/domain1
shows up in the browser as
http://www.domain1.com
..and all subpages and sections show up under their aliased domains.
We can’t find a way to do this in WP.
Can your plugin be modified to handle this issue? Do you know of a solution? We are willing to help fund development of a plugin to do it, or for any useful answer.
Thanks,
Dave
October 19th, 2007 at 1:30 pm
Dave,
my blog (kitab.nl) is censored in Tunisia (DNS censorship and not IP). I’m planning to install AA-DomainMirror to enable people bypass the ban by accessing my blog through the 2nd domain name. My question is, will it possible to change the 2nd domain name whenever it is being blocked in Tunisia?
thanks
October 20th, 2007 at 12:48 pm
It’s working, wonderful: http://www.kitab.nl = http://www.fartattou.com
many thanks Dave fopr this plugin
October 22nd, 2007 at 12:59 am
I just posted a fix for WordPress 2.3. Thanks to SecondeView for the solution and sorry for the delay. Download the file from the link at the top of this page and replace the file WP-DomainMirror.php
Dave
October 23rd, 2007 at 7:41 pm
So, I installed the plugin to my “main” website server. I’m assuming that I need to upload all of my Wordpress documents to the mirror site in order for the domain mirror to work correctly, right? Then via the plugin, all new posts and information will be updated in the domain mirror as well?
November 1st, 2007 at 12:24 pm
I’ve just tried it with my WP2.3 my main domain is http://www.anujgakhar.com and I added another parked domain from cpanel http://www.cfcoder.co.uk . however, when I open cfcoder, it doesnt change any links at all. All links still point to anujgakhar.com
any idea what I am doing wrong?
November 7th, 2007 at 3:20 am
Hi! Thanks for this plugin.
I have a feeling that this may be conflicting with my Search Widget function… it defaults to the main index page.
Has anyone reported such a problem?
Thanks
peter
November 8th, 2007 at 9:40 am
hi, thanks for this great plugin!
I have a trouble:
I did:
install wordpress in: domain.com
create a subdomain: 2nd.domain.com
install plugin in: domain.com/wp-content/plugins/AA-DomainMirror
configure everything as you detailed.
and when I go to 2nd.domain.com, I get this message:
“Forbidden
You don’t have permission to access / on this server.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. ”
I haven’t installed anything in the subdomain 2nd.domain.com….
not even a index.php or anything… maybe this is the problem…
thanks for the help!
November 8th, 2007 at 9:40 am
using WP-2.3.1
November 18th, 2007 at 8:29 pm
What if I want specific content to display per domain? For example… I have xyz.com and abc.com. So is there a tag I can put in like site-name-logo.gif so it loads either xyz-logo.gif or abc-logo.gif depending upon the url?
December 18th, 2007 at 5:19 pm
Hi Dave, thanks for a great Plugin!
Other than the back slashes (which you’re aware of, by the looks of things), all seems to be working fine.
I’m sort of edging towards a similar scheme to Matt above. I don’t know if that’s within the remit of the plan you have for this Plugin or not.
In addition to Matt’s suggestions, I’d be wanting to associate a web address to a specific category or web page…
December 18th, 2007 at 8:27 pm
Also, what are the implications for duplicate content penalties?
February 6th, 2008 at 2:35 pm
Hello,
I get the following errors on a WP 2.3.3 install:
Warning: require(config.inc.php) [function.require]: failed to open stream: No such file or directory in /xxx/home78a/xxx/xxx/xxx/wp-content/plugins/WP-DomainMirror.php on line 57
Warning: require(config.inc.php) [function.require]: failed to open stream: No such file or directory in /xxx/xxx/xxx/xxx/xxx/wp-content/plugins/WP-DomainMirror.php on line 57
Fatal error: require() [function.require]: Failed opening required ‘config.inc.php’ (include_path=’.:/usr/local/lib/php/’) in /xxx/xxx/xxx/xxx/xxx/wp-content/plugins/WP-DomainMirror.php on line 57
I know the first two are just warnings, but the last one is a problem.
February 18th, 2008 at 6:12 am
great plugin, thanks. been looking for something like this.
I’ve tried this plugin with WP2.3. I am using cpanel so I added a parked domain from cpanel. Everything works fine but all links to images still point to the main domain.
any help would be greatly appreciated.
tash
February 18th, 2008 at 6:38 pm
Have a problem, huh. I made a new domain and uploaded a copy of the blog on it. Then uploaded your plugin.
March 19th, 2008 at 12:43 am
Hi,
Perhaps you should rename the directory to “%%-DomainMirror” since there is a plug-in called “404 Notifier” which would sort ‘alphabetically’ before ‘AA’.
I am just about to try this plug-in along with the hints on Mike Davidson’s blog regarding making a site mobile friendly.
http://www.mikeindustries.com/blog/archive/2005/07/make-your-site-mobile-friendly
I don’t know if I also need “Wordpress Mobile Edition” as well. Guess I’ll find out.
~Andrew~
March 31st, 2008 at 5:10 am
[...] Domain Mirror - So that I can use subdomains like “mobile.mikeindustries.com” [...]
April 21st, 2008 at 10:44 pm
To all!
We wanted to use Domain Mirror for linking up http://virtualization.com and http://virtualisation.com but were kinda suspicious if it wasn’t too bad for SEO. Turns out we were right to worry
Please note that there is a high risk of getting penalties from Google because of duplicate content, which may affect both your URLs / websites rankings!
See Google group discussion here:
http://groups.google.com/group/Google_Webmaster_Help-Indexing/browse_thread/thread/ea60d87779470b6c#
April 27th, 2008 at 12:21 pm
[...] to point to a single Wordpress installation. This turned out to be easily accomplished using the Domain Mirror plugin and changing the tagline slightly in each site should prevent Google penalizing them as [...]
April 27th, 2008 at 12:28 pm
[...] to point to a single Wordpress installation. This turned out to be easily accomplished using the Domain Mirror plugin and changing the tagline slightly in each site should prevent Google penalizing them as [...]
April 30th, 2008 at 4:23 am
I didn’t install the fix and it seems to be working. What does this fix do? Is it really needed?
tnx a lot dude, I looked everywhere to a way to use multiple domains for my blog. Now I can do it
really tnx!
May 4th, 2008 at 6:50 pm
[...] plugin is a solution for those running both the Domain Mirror and the Google (XML) Sitemaps Generator plugins together in Wordpress. Specifically it [...]
May 4th, 2008 at 7:20 pm
Hey all,
I have written a small plugin that allows Domain Mirror to be used together with the Google XML sitemap so that you can have multiple domains pointing to the same Wordpress installation, but have one properly formatted sitemap for each domain (with the correct URLs in them).
Description, downloads and instructions available at http://www.actionscriptdeveloper.co.uk/google-xml-sitemaps-mirror-wordpress-plugin
Comments very welcome, and hope that someone finds it useful
Dave Keen
http://www.actionscriptdeveloper.co.uk