Forums

multiple domains, but not at root (foo.com/blog, bar.net/blog, baz.com/blog) (10 posts)

  1. JamesManning
    Member
    Posted 12 months ago #

    Versions:

    • WordPress 3.1.3 with MultiSite enabled
    • Windows Server 2008 R2
    • IIS 7.5
    • URL Rewrite Module 2.0
    • MySQL for database

    I'm trying to have multiple domains served as different 'sites' with WordPress, but in each domain, it's not at the root, but instead at a path of /blog - it's the same path (/blog) on each domain, though.

    The target urls are therefore something like this (there will be around a dozen or so)

    Summary: What mechanism(s) are recommended for having this kind of setup? The MultiSite support seems to 'natively' support subdomain (blog1.foo.com, blog2.foo.com) and subfolder (foo.com/blog1, foo.com/blog2), and the MU Domain Mapping supports different domains *if* the blogs are hosted as the site root, but I haven't found a mechanism to support multiple domains when the site is not at the root, but instead at a fixed path of /blog/

    Detailed:

    In IIS, I have an existing website that handles all the top-level sites (http://www.foo.com/, http://www.bar.net/, http://www.baz.com/) and installed WordPress as an application (right-click, Add -> Application) under that existing site with a path of 'blog'.

    After enabling multi-site, the first/existing blog of http://www.foo.com/blog/ is still working fine, but since it wasn't installed at the root of the site, it only allowed me to choose 'subdirectory'. So, at the moment i have the other blogs created, but they're currently at url's like:

    The setting up of the network had me add a set of IIS rewrite rules which allow these other blogs to work fine. One caveat was that one of the rules, targeting ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) (listed as WordPress Rule 5), was incorrectly targeting {R:2} instead of {R:1}, so the resulting request was to content instead of wp-content. Thankfully that was simple to fix, and it might be a change in regex capture-group behavior with the url rewrite module for all I know.

    I had initially hoped that that I would be able to use the WordPress MU Domain Mapping plugin (available at http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/), but when trying to do so, trying to access wp-admin for any of the blogs (even the 'main'/first one) to login gives this error:

    ***********
    The domain mapping plugin only works if the site is installed in /. This is a limitation of how virtual servers work and is very difficult to work around.
    ***********

    The error message referencing virtual servers makes me wonder if the difficulty was specifically around Apache virtual servers and perhaps doesn't apply (or has a workaround) for IIS 7.5 + URL Rewrite, but since the error message doesn't give more detail, I won't know without digging into the source or getting lucky and finding a thread discussing it.

    Funny enough, thanks to this error, I'm actually in the position of not having a UI for disabling the plugin, but I'm not worried about that at the moment. :)

    So, I'm trying to figure out the best approach at this point to get the target url's.

    - add some more rewrite rules to try and handle the other url's correctly?
    - try modifying the MU Domain Mapping to support non-root paths?
    - something else?

    Thanks!

  2. Andrea_r
    team pirate
    Posted 12 months ago #

    I haven't found a mechanism to support multiple domains when the site is not at the root, but instead at a fixed path of /blog/

    Just before we get too far into it.... are the main domains of these sites hosted elsewhere?

    You want
    http://www.foo.com/blog/
    http://www.bar.net/blog/
    http://www.baz.com/blog/

    But where are:
    http://www.foo.com/
    http://www.bar.net/
    http://www.baz.com/

  3. JamesManning
    Member
    Posted 12 months ago #

    Those are all served by the same IIS web site (it has bindings for each of those hosts).

    The target url's work now (in terms of being accessible by a web browser over the internet), but when accessing them, they all redirect back to http://www.foo.com/blog/ (the first/main one).

  4. Andrea_r
    team pirate
    Posted 12 months ago #

    Okay.. what do you want to show at bar.net?

    Because you cannot map folder names.

    If you do not want bar.net as part of the multisite install, you're out of luck.

    If you DO.. .then just map bar.net. Make a /blog/ page.

  5. JamesManning
    Member
    Posted 12 months ago #

    The root web site is a different webapp (asp.net 3.5 app, unrelated to wordpress). It's been working fine for the various domains already. WordPress is installed at a wholly separate location in terms of the filesystem, and is installed at /blog under that existing website in terms of url, so any of those domains being accessed with a url path at or under /blog will get routed to the WordPress app. I'm not sure what the equivalent situation with Apache would be to translate it to (on a *nix machine, i'd likely just make a symlink, but that's not quite the same thing).

  6. JamesManning
    Member
    Posted 12 months ago #

    Another way of phrasing (that might make more sense?) would be that the DNS / web server / etc issues of getting the particular url's routed to WordPress is working, but I can't figure out how to tell WordPress that the incoming url's of http://www.bar.net/blog, http://www.baz.com/blog, etc. should map to its existing subdirectory blogs (there's nothing in them yet, so killing them and re-creating them in a different manner is fine if that helps).

    Looking in wp_blogs (which along with wp_sites seems to indicate I have 1 site and 11 blogs, instead of 11 sites), for instance, it looks like I could take the Domain column (which is currently all http://www.foo.com) and Path (which is /blog/ for the 'dashboard blog', and /blog/bardotnet/, /blog/bazdotcom/, etc for the others) and modify it to match the intended incoming url's. I'm guessing it's not actually that simple, since the blog url ends up in many other places (like all the wp_*_options tables, 1 per blog), but hopefully that gets across the intent. :)

    Thanks!

  7. lgordo
    Member
    Posted 4 months ago #

    Hi James, did you ever get an answer to that?

    I have various domains such as foo-keyword.com, bar-keyword.co.uk, etc-keyword.net that are all independent sites that capitilise on their domain name. All are have been badly coded by me!

    I am looking to redesign them and others with WP's clean code and be able to maintain them using WP as a CMS.

    Mine are hosted on 1and1's apache server that allows multiple domains (and subdomain creation) within the same package/space. I don't want a network of foo.thisDomain.com, bar.thisDomain.com and etc.thisDomain.com

    Do you or anyone know if this can be done.

  8. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 4 months ago #

    Because you cannot map folder names.

    If you do not want bar.net as part of the multisite install, you're out of luck.

    That remains true.

    If you want domain.com/<folder> to be a site, you install at domain.com

    If you want sitename.domain.com, ditto.

    I don't want a network of foo.thisDomain.com, bar.thisDomain.com and etc.thisDomain.com

    So ... what do you want? Just install WordPress in foo, bar and etc as separate installs.

  9. lgordo
    Member
    Posted 4 months ago #

    Okay, cheers

    Just one more question though (I am new to WP) - 1and1 supply a single mySQL db with my package, can/will that support multiple instaltions of WP?

    I have managed to set up a WP network installation and *.domainName.com will work for some of my websites, I dont want to break that - If i install additional WP's in other domain and sub-somain folders will there be a conflict when i reference the db?

    thanks in advance for your advice (and patience)

  10. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 4 months ago #

    You can use one DB for multiple, separate, sites. HOWEVER. Pick a different prefix for each one.

    So wp_ is the one you have now. Pick othersite_ and anothersite_ for the others.

    Though also check how much DB space you get.

Reply

You must log in to post.

About this Topic