Domain Mirror Plugin
Wordpress 2.8.5: Works.
Wordpress 2.8.4: Works.
Wordpress 2.7: Works.
Wordpress 2.6.2: Works.
Wordpress 2.6.1: Works.
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.
Fill in the details for the 2nd domain, and click Save Changes.
Now, when viewed using the first domain, the site remains unchanged.
When viewed using the second domain, the site appears as if configured for that 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.











I’m actually looking for exactly the opposite, that is to say a plugin that will keep two wordpresses at different servers in sync so that should one server go down I can use ZoneEdit to transfer requests over to the other server. Do you know of anything that does that?
I can see that it would need to do the following things:
1) when a post is made a copy is sent to the other wordpress so a copy is posted there.
2) if an image was uploaded for a post it needs to be sent to the other wordpress.
3) when a comment is made it needs to be sent to the other wordpress to appear there.
Since only one of the wordpress installations (the dominant domain) would be accessible via DNS they would need to know each other’s IP addresses.
There may be other complications I’ve not thought of.
Thoughts?
Cheers,
-Walter Jeffries
http://SugarMtnFarm.com/blog <– not on wp but should be.
http://NoNAIS.org <– on wp
Walter,
The best way to do that would probably be by replicating the data at the database level, although you would need to replicate images separately .
http://dev.mysql.com/doc/refman/5.0/en/replication.html
Dave
hi, i am using this plugin, but since there is an apostrophe in my site’s tagline, it’s screwing up and adding a backslash. anyway of fixing this? or skipping this step and having it just use the same tagline the other site has? the URL i’m trying to mirror is 100bandsin100days.com to 100bands100days.com
thanks in advance
nick
Yep, that’s a bug. I’ll have a look at it.
I still didn’t get any email from you with the category domain mirror
Is it stil possible to get it
Just catching up with things. A copy is on the way.
I am trying out this plugin and I like the idea. But it appears to have bugs. I try the latest WP (2.7) and try to reach a development blog from all of these locations: “localhost/testblog” (on the machine itself), “mypcname/testblog” (through its LAN name), “mypcname.local.xx/testblog” (through its LAN DNS name) and “xyz.dyndns.org:1234/testblog” (from the internet, through a port-forwarding NAT router).
It looks like the site really only works on the one name defined in the WP settings. With all the other locations, the plugin tries its best, but at several places in the templates it still uses the WP settings name (localhost in this case) instead of the “configured” name. I found this to be particularly true for the “bloginfo(’stylesheet_url’)” function, which will still return “localhost” untranslated in all contexts, but there probably are other functions that go untranslated as well.
Is this a bug? Am I doing something wrong? Do I need to change my template code? Or can you provide a fix?
Thank you very much –Daniel
Daniel,
This tends to happen when one of your plugins loads in front of the Domain Mirror plugin and so can’t see the changes it makes. The only way I’ve been able to control the plugin load order is with the name of the plugin directory as they appear to be loaded in alphabetical order.
@DaveMc
I’d be interested in that beta, as it happens I need a category hidey/showy thing for two domain right this very moment!
Have you had a chance to check this out?
Would my domains being hosted on a Windows platform have anything to do with the problem being experienced?
Gary
I have a new version of Domain Mirror available that allows different post categories to be shown on each site. If anyone is interested in testing it give me a shout.
Dave
Wow that sounds very interesting, Dave…
I’m doing that right now, where each domain basically redirects to a specific category, or set of categories.
Does this new version of the plugin make it so certain categories are NOT accessible from the other domains? That is the only problem I have currently having.
Example:
(Post in Category 12)
works with both http://www.domainONE.com/post_123
or http://www.domainTWO.com/post_123
What i’d really like is if a post is in Category 12, it will ONLY appear for domainONE.com… that would be ideal and make things easier with Google.
- Michael
Michael,
Yes, that’s exactly what it does. The categories that are excluded from a domain don’t even show up in that domain’s admin screen – although the total number of posts shown there is still the correct value. The current version works by category number so you need to figure those out, but that could be made more user friendly.
I’ll make up a zip file later and send you download link.
Dave
Hi,
I was looking for that same plugin that will allow to do domain mirror but will show different categories or posts on each domain, if it is okay, I would also like to have a copy of the new plugin you have as Michael was referring to… Hoping for your kind consideration… thanks
I’ve emailed you an updated PHP file.
Dave
Dave,
Got the e-mail, thanks!
Before I install it, I wanted to double check with you on running the new version with UI disabled… I currently do not use the UI for the plugin and edit it manually.
What would I add to the config.inc.php for allowing the categories, in preparation for installing the new plugin version?
Thanks… looks great. By the way, in order to include Pages, I would also include “0″ on all domains?
- Michael
Hi Dave,
Thanks for a great plugin. I’m updating my sites (http://www.garysoffice.com -MAIN and http://www.riverlandpages.com – MIRROR) and everything apart from my Contact page seems to be OK.
I can submit my contact form from the MAIN site but can not submit the form from the MIRROR site.
For info, I am using CForms 9.4.
I am on a windows hosting platform and the riverlandpages domain is an alias for the garysoffice domain.
I suspect that because I don’t have any email addrersses setup for the MIRROR it is not able to process any email via the form.
Do you have any suggestion as to how I can get the two domains to play nice with CForms?
Gary O
Gary,
I haven’t used that particular plugin, so I’ll have to do a little testing. I use Contact Form ][ and that hasn’t given me any problems so far.
Dave
Thanks Dave, in the meantime I’ll check out the plugin you are using and report back if I am still experiencing the same problems.
I’ve tested it with CForms and it doesn’t work for me either, but I think that is to me expected as there are warnings in the instructions about it failing to work if the email address isn’t as expected – so I thing it may be doing some sort of validation on the address. I think the solution might be to swap the email address used for each domain. I’ll check to see if that’s possible.
Thanks Dave,
I also tried Contact Form ][, but that did not work either for me.
In my Installed plugins list it states I’m using 1.3beta, I note above only 1.2beta is listed.
I also had CForms setup to use my gmail email address, same issue arose, I could send email via the Main domain (garysoffice.com) but not from the mirrored domain (garysoffice.com).
I’m not fussed what contact plugin I use as it is just basic contact details – just want to be able to use one which works from both domain names!
Happy New Year!
That’s great to hear, thanks for the update, Dave!
Michael
(At least that is one great plugin I won’t have to worry about when I upgrade!!!)
New WP 2.7 RC1 is out now… I’m just wondering if you have any idea whether or not Domain Mirror will function with actual 2.7 release? I’m using it without any problems on a 2.6.5 install (manually upgraded).
Thanks,
- Michael
Yes, Domain Mirror is working fine with Wordpress 2.7 RC1 – I’m running it here already.
oh no sorry, i guess now its refreshed, i had to logged into the admin and now it seems updated…
sorry to bother, and thanks again for this beautiful plugin
Hello there,
I’ve been uisng the plugin without any problems, but i just noticed today that for some reason the mirror address dont update for a while, is this a common issue ?
my main bog : cyanatrendland.com
my mirror : trendland.net
Can you please let me know, or i maybe have to do something ?
Thank you
Wonderful Plugin !
thanks a lot, i was trying to this for a while now and thanks to you now we are able to ! so now i have trendland,net and cyanatrendland.com the same 
Merci Merci !!
I have just installed Domain Mirror on WP 2.6.2. At the top of this page it says it works, but it seems there are issues with some plugins. The plugins that are being kept up to date and have implemented the new constants for moving directory locations are those having problems.
Please can you update the status at the top of the page to reflect that there might be some issues with plugins.
I have had a look at the Domain Mirror plugin source but I couldn’t find an easy fix – probably as I have never written a WP plugin before. I did find these details on the WP Codex: http://codex.wordpress.org/Determining_Plugin_and_Content_Directories
If you can produce a fix it would be appreciated.
Nick
how to point subfolder of subdomain to the subfolder of main-domain ?
when I check my site from subdomain, it redirects to the same old installation of orginal domain.
please help.
Hello,
This plugin looks like it might be what i need, I think.
I have a blog (http://djs-music.com) and it was originally in english. I then translated it to Spanish, with a new theme that is the same but with all sentences and stuff in spanish. Original theme was by me, called reloaded. Spanish theme reloaded_es
I then created a subdomain called es.djs-music.com and directed it to djs-music.com now what I want is to use domain mirror to display the template reloaded for one, and the template reloaded_es on the other one. How can i do that?
You can get this to work on the surface in Cpanel by adding the domains as “addon domains” and making the directory whereever the blog is. For instance mine isn’t top level and is under the director “blog” so I used this directory when creating all new addon domains. Then I set these up in this plugin. When you go to the sites domain names, they do indeed point to the wordpress installation in the blog directory but when you click on anything you get an internal server error.
Well it seems like this plugin should accurately be labeled as a plugin for those with Dreamhost. It doesn’t work when using Cpanel.
I’ve just spotted the 2.6.2 update, and will be updating to it myself, so Domain Mirror support will be coming soon.
Wondering if DomainMirror will be compatible with 2.6.2 WP release? Due the to the changes with open registration or whatever they have changed… I am wondering if upgrading will have any adverse affect on the plugin? I am hoping to upgrade… but only if I can continue to use the domain mirror! Thanks Dave.
I just upgraded this site to Wordpress 2.6.1 and everything is still working with Domain Mirror. I’ve very puzzled. I suspect the unserialize problem may only occur with 2.6. I’ll try and test that later but will have to roll my test database back to do it.
Dave
Hi, Dave.
Thank you for plugin.
But there is a problem.
If I upload theme only in the main site, domain mirror can’t work, so when I upload theme to the domain mirror it works great. And the question is: may I upload a theme only in the main site?
Hi Dave
First i have to say great plugin!
But I have a small request:
Could i t be possible to add a custom field to the setup. This way it could be possible to add some extra code. or example Google anlytics?
I think it would be great.
If you log into 1st domain, will the cookie persist over to the 2nd domain using this plugin so that the user wouldn’t have to log in again?
could it be an issue that my host has set up mysql with this?
MySQL charset: UTF-8 Unicode (utf8)
More info:
I currently have the following value for wpdm_options in my wp_options table:
a:10:{s:8:”domain_1″;s:0:”";s:10:”blogname_1″;s:0:”";s:17:”blogdescription_1″;s:0:”";s:9:”siteurl_1″;s:7:”http://”;s:6:”home_1″;s:7:”http://”;s:7:”theme_1″;s:17:”WordPress Default”;s:10:”template_1″;s:7:”default”;s:12:”stylesheet_1″;s:7:”default”;s:10:”use_themes”;i:0;s:5:”count”;i:1;}
I am installing on 2.6, using AA-DomainMirror as my directory.
I installed both:
DomainMirror-v1.2beta.zip
WP-DomainMirror-2.3fix.zip
after activating the plugin, I get a a series of errors like this before the page displays:
Warning: unserialize() expects parameter 1 to be string, array given in /domainrootwordpress/wp-content/plugins/AA-DomainMirror/WP-DomainMirror.php on line 58
this happens with all versions up above actually, and it happens with and without the 2.3 fix.
incidentally, I noticed the text files in some of the deliveries have DOS line endings, even after converting them to Unix, I still get the same errors.
google doesn’t seem to show anyone else reporting this, so what might be up?
Will this plugin work on ver 2.6 of wordpress
I want to use multiple themes to display different (not mirrored) content. Can this be done?
For example, I’m using a default WP theme for my guitar lesson blog here: http://www.LogicalLeadGuitar.com/wordpress
But I also want to do an online guitar magazine, using the Branford Magazine theme, which I hope to place here: http://www.LogicalLeadGuitar.com/magazine (obviously, this isn’t active yet).
Certainly someone out there is running multiple blogs with different content, and using different themes?
But how????
Any help greatly appreciated.
Adam
used this on a friends blog and it worked no problem, but today i installed it on mine and once i “activate” the plugin i get this error:
Warning: unserialize() expects parameter 1 to be string, array given in /htdocs/blog/wp-content/plugins/domain-mirror/WP-DomainMirror.php on line 47
both of the blogs are running wp version 2.6
any help on how to fix this?
Anyone else having problems with this plugin and WordPress 2.6?
I’m running WordPress 2.6, with the 1.2beta / and the WP 2.3 fix of this plug-in and I’m getting:
Warning: unserialize() expects parameter 1 to be string, array given in /wp-content/plugins/AA-DomainMirror/WP-DomainMirror.php on line 58
Any ideas?
First off, I have found this to be an absolutely great plugin, incredibly useful and easy to configure. Recently I have been testing Wordpress 2.6 and the plugin is simply not working with it. Apparently they have decided to define the constant WP_CONTENT_URL on line 276 of wp-settings.php and the get_option(’siteurl’) function is not being filtered by the plugin. I think this is because the constant is being defined before activating the plugins, but I could be mistaken.
I wanted to thank you for the plugin and see if you have had any thoughts on this change in WP 2.6. I would appreciate any suggestions or fixes you have come across, and I will be looking further into the issue on my own and I’ll be happy to share any findings I have on this as I find them.
Cheers, ~n
Okay, at some stage soon after installing (not sure when) the plugin stopped working completely, and now won’t retain any of the information I save on the options page =(. Heh.
I installed it – easy, very cool, and I the settings are easy to input, but it just doesn’t work… – http://www.youcanstandundermyumbrella.com/ – if you have the time to offer suggestion DaveMc, it’d be appreciated.
@DJSlim
I always try to be nice – but I only approved it 5 minutes ago, so it couldn’t have been deleted.
I’m not sure why your second domain won’t log in, as far as I remember I originally wrote it for 2.2, and am now running 2.5.1 and all functions, including logins, have always worked for both domains, unless cookies are rejected. That’s the only thing that caused it to fail for me.
@Alexy
If you edit the config.inc.php file you can add your domains in there and then won’t have to use the web interface at all. That’s probably the best way to add large numbers of mirrors.
@Sergy
At what point are you redirected? When you try to configure the 2nd record or when you try to access the site?
Good day.
I can’t add more than 1 mirror domain.
When I tried to go to the second I was redirected to the main.
Thank you, Sergey
Exceelent plugin, BUT
It’s uncomfortable to add more than 1 domain mirror. Because you should refresh you site each time when you want to add a mirror.
How can I have more than one adding form.
Thank you, Alexey.
I asked a simple question about your plugin. Waited like 3 days to have it approved and come back to find it deleted. Thats real nice.
Here is my question again and hopefully this one doesn’t get deleted.
I am trying to utilize the plugin. All works well with both domain names except for logging in on the mirrored domain. When you attempt to login from the mirrored domain it doesn’t let you. Using 2.3.3 with the correct versions of the plugin
I have this setup and it works perfectly except you can’t login using the mirrored domain.
Any thoughts on this??
Im looking for a plugin that is simple and clean like Domain Mirror, and that also let us choose a category or page to be shown on home page for each domain. With that we could even create subdomains to point to caterogies.
If somebody knows a plugin that does that plz tell me shidou.hikari at g mail com
I’m looking to a plugin that’s simple and clean like Domain Mirror, but that lets us choose a category or page to be shown oh home page for each different domain. With that we could even create subdomains to point to categories.
If somebody know a plugin like that plz tell me spf01 at hikarinet info
I’m try to use version 1.2+ “2.3patch” – and this perfectly working on 2.5.1
I installed your plugin on http://www.nawaat.org/ and created a mirror subdomaine on dreamhost at http://map.plpp.org
but when I try to visit the later (http://map.plpp.org) I’m redirected to http://www.nawaat.org, any idea how to solve this.
many thanks for the pugin
hi there .thanks for plugin:
Does anybody know if tis script is compatible with Wordpress 2.5.1 ?
Thanks in advance for any help on this!
regards
BTW, custom tags would also allow unique Google Analytics accounts to be used
Dave, I can’t tell you how useful your plugin is going to be for me – I owe you a pint next time you’re in Edinburgh.
One thing that would really hit it out of the park, though, would be the ability to define custom tags to use alongside the four standard tags. That would open up a whole new level of customization – for instance, different domains could feature entirely different graphics, different CSS files, Recent Posts lists specific to a category specific to that domain, and the ability to enter a unique block of text for each domain’s introduction would address Google’s duplicate content penalty.
Essentially, you would have the convenience of running one installation of WP but the unlimited ability to customize each domain’s expression of it. Having followed the MU forums for quite a while, I can tell you that this is an ability that is much-wanted and continually requested but that MU is simply unsuited to. Your plugin, along with Dave Keen’s Sitemaps twist, would be a far better solution.
So, do you think this is a feasible feature?
Is it something you would be interested in adding?
And, if not, do you think it would be a tricky customization for me to attempt myself?
Thanks again for such great work.
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
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!
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#