The MU forums have moved to WordPress.org

WPMU In Sub-Folder And Blogs In Subdomains? (3 posts)

  1. richcon
    Member
    Posted 14 years ago #

    I'm trying to install WordPress MU on a web site with existing content in the root folder. So WPMU cannot be installed in the root folder, but rather in the subfolder 'blogs/'. The URL for WPMU would be something like:

    http://example.com/blogs/

    However, I want to use subdomains for hosted blogs. Unfortunately this means that the URL WPMU comes up with for each of them would be something like:

    http://coolblog.example.com/blogs/

    I really want to drop that trailing 'blogs/' path, so I'd get something like:

    http://coolblog.example.com/

    I can handle parking the coolblog.example.com subdomain in the WPMU installation folder. I just need WPMU to be aware that there's no '/blogs' path at the end of the URL.

    (Alternately, I could move the WPMU installation into its own subdomain, blogs.example.com, but I'd still want its hosted blogs to have their own second-level domain, *not* coolblog.blogs.example.com.)

    Is there any way to do this?

    Thanks!
    Rich

  2. richcon
    Member
    Posted 14 years ago #

    I seem to have figured out a solution. The WPMU installation needs to be on the root level of its own subdomain (blogs.example.com), which lets me leave the main web site alone.

    Normally this would give a hosted blog a URL like coolblog.blogs.example.com, when I want coolblog.example.com. To fix that, I went in to the mysql database by hand (dangerous, I know), opened up the options table for each blog, and changed everywhere its URL appears to the correct URL. It seems to be working now, though I'll know better after running it through some heavier tests.

    I couldn't use this approach while the main install is in a path, because pretty permalinks would break without some very creative edits to .htaccess. I'd rather not go mucking with it, so I went with the all-subdomains solution.

  3. richcon
    Member
    Posted 14 years ago #

    Now that I've thought about it, I bet I could get it working with paths too but it'd take an extra step to keep pretty permalinks from breaking.

    The issue here is that the .htaccess file needs to know what path it's installed in (for mod_redirect) to make pretty permalinks work. Set the base path to '/', and permalinks only work when run at the root level of whatever server it's on. Set the base path to '/blogs/', and it only works properly when run from the '/blogs/' path on its server.

    So, you could install wordpress mu in, say, a '/wpmu/' directory, have its .htaccess file use '/' as the base path and host every subdomain blog from within that directory. Then pretty permalinks will work for subdomains.

    Then create a second directory. '/blogs/', and in it create a copy of the .htaccess file but leave the directory otherwise empty. In that second .htaccess file, set the base path to '/wpmu/' to point to the directory that the software's actually installed in.

    Now, theoretically, you should be able to launch wordpress mu successfully, pretty permalinks and all, from either the '/blogs/' path on the main domain or the '/' path on subdomains.

    (I won't try this because I'm happy with my all-subdomains solution for now.)

About this Topic