WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MU Domain Mapping
[resolved] Domain Mapping Enhancements (6 posts)

  1. Rory Murphy
    Member
    Posted 8 months ago #

    I thought this might be of some interest - I have just released a tweaked version of this plugin that will allow a single multisite instance to handle both sub-directory and sub-domain based URLs. Underneath the hood, it uses a sub-directory install but, with a little sunrise.php magic and a couple filters, those sub-directory based sites can be mapped to domain based URLs (or any other). Don't know if it would it be of interest to include in the core of the plugin, but it's available at https://github.com/rorymurphy/wordpress-mu-domain-mapping.

    http://wordpress.org/plugins/wordpress-mu-domain-mapping/

  2. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 8 months ago #

    with a little sunrise.php magic and a couple filters, those sub-directory based sites can be mapped to domain based URLs (or any other).

    The current version can do that without any tweaks.

  3. Rory Murphy
    Member
    Posted 8 months ago #

    Actually really glad to hear that - I did a first hack while working at a previous employer about 18 months ago and just recently had the time and the freedom to rewrite things from scratch. I hadn't been keeping up with all the updates, but great if it's out of the box.

    I pulled down the latest and tried 3 scenarios my updates support, two of which appeared to work and one which did not. Wanted to check if I'm doing something wrong. The last one involves mapping to a different domain and a different sub-directory name, so I wasn't sure if that is a supported mapping type. Appreciate any insight.

    Sub-directoty based multisite install at http://www.domain1.com/ with a blog called myblog. Domain mappings are

    http://www.foo.com/myblog (works)
    http://www.bar.com/ (works)
    http://www.foobar.com/testblog (redirects me to the root wordpress site at http://www.domain1.com)

  4. Rory Murphy
    Member
    Posted 8 months ago #

    Side question, but, in the past, every once in a blue moon WordPress would seem to get confused about URLs for media items and start returning URLs off http://www.foo.com for every request, regardless of which URL users came in on. This was a problem for us since http://www.foo.com required authentication, causing images to 403. Have you ever heard of anyone else experiencing this behavior when using the plugin? It would only occur every few months without a clear cause, so it was impossible to debug, hence the added filters to attachment URLs for insurance. Strangely, when we did see it, un-attaching and re-attaching one image to one post seemed to correct it across all pages and sites.

  5. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 8 months ago #

    http://www.foobar.com/testblog (redirects me to the root wordpress site at http://www.domain1.com)

    Domain mapping is for mapping domains vs mapping domains and paths. Domain maps are to the root of the website. DNS works on domains not domains and paths.

  6. Rory Murphy
    Member
    Posted 8 months ago #

    I'm not sure I follow how the piece about DNS - http://www.foo.com, http://www.bar.com, and http://www.foobar.com are all CNAMEd to http://www.domain1.com and they are all ServerAlias-es on the same VirtualHost. So all the requests are getting to WordPress the exact same way and that's all separate from WordPress's ability to map a URL to a blog id and vice-versa, which the plugin handles quite nicely.

    My intent was only to offer up that, with the code I referenced (which is free for one and all), the domain mapping plugin can be used to allow sites to be mapped to an even wider array of URLs - with a very minor tweak to one of the rewrite rule for the media files in .htaccess, it can even allow you to have an authoring URL like http://www.domain1.com/foobarblog/ and serve it up externally at a URL like http://www.foo.com/bar/space/filler/myblog/

    I found the modded domain mapping plugin indispensible when I was administering dozens of sites in a large media & technology company. We would use it for all sort of ad-hoc sites - sometimes in a root domain, but often as a micro site in a sub-directory off a domain where the main site was served up by different servers using a different technology (and a sub-directory was reverse proxied to our WordPress cluster). We didn't always have any flexibility in the URL structure - if the CEO said he wanted his blog to be http://www.foo.com/about/ceo/, we could make it happen using the same multisite instance hosting http://www.bar.com/. There were also cases where we had two sites with seemingly conflicting names - http://www.coolproduct.com/about/ and http://www.hotproduct.com/about/, but we could handle this by making the authoring URLs something like http://www.domain1.com/aboutcool/ and http://www.domain1.com/abouthot/ and using the plugin (with mods) to map them to their correct external URLs.

    Totally cool if a lot of that is outside the uses you had intended or wish to support for the plugin, but I found it extremely valuable to pushing WordPress's limits and allowing it to be used as an enterprise platform for all kinds of sites beyond blogs, and wanted to put it out there for others who might be trying to do the same.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.