Support » Networking WordPress » Subdomains with WP in subdir – possible or not

  • Hello,
    I’m running the latest version of WordPress from a subdirectory ( I activated multisite which only offered subdomain version as I’m already running an older site. So far OK, I’d like to use subdomains anyway. However, I am finding contrasting information on this. Some say it is not possible to run subdomains if wordpress is not installed in the root but if it was true, I could not use multisite at all.

    I also tried to create a site with one of the unused addresses already set up in the server DNS records but to no success. When I try to access the new site dashboard, I get 404 Not found.

    Thanks a lot.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz


    Well, the Codex says subdomain multisite is only possible with WP installed in public root. You must use subdirectory multisite for subdirectory WP installations. It’s a bad idea to ignore Codex recommendations on important production sites. That said, you may be able to finagle a workaround. Completely untested, but seems feasible. Insert the site’s required .htaccess code into the public root .htaccess instead of the WP subdirectory’s .htaccess.

    Change the RewriteBase to /. Change the final 2 RewriteRules to lead to the WP subdirectory’s resources (if it does not already), for example

    RewriteRule ^(.*\.php)$ /blog/wp/$1 [L]
    RewriteRule . /blog/index.php [L]

    (added /blog/ to each destination since my WP is in the /blog/ subdirectory)

    Remember that WP works by us requesting server resources that do not actually exist. For the permalink to work, there cannot be an actual folder or file named hello-world. Be sure there are no folders or files named like the subdomain you are trying to use.

    Don’t try this on an important site until it’s been thoroughly tested on a test or staging site. These instructions may not be 100% accurate, this is just a half baked theory at this point. I think the concept is valid, but the specific details may need adjustment. I could be wrong and this simply cannot work. Let me know how it goes.

    Thank you, I’ll look into this. There’s one think that seems strange to me.
    1. I can’t use subdomain-based multisite with wordpress in a folder
    2. I can’t use directory-based multisite if it’s not a fresh install.

    1+2 = I can’t use multisite at all if I’m already running a website and my WordPress is already in a folder. That’s exactly my situation 🙁

    Moderator bcworkz


    1. That’s in agreement with what the Codex says. So it’s not really “broken”. As I said earlier, there could be a workaround, but it would definitely be a not recommended hack. But if it works for you ¯\_(ツ)_/¯

    2. This should be resolved before trying anything unorthodox like subdomain multisite in a subfolder. Most people go multisite with a fresh install, so converting an existing site is sort of a niche use to some extent. Meaning unanticipated problems could occur due to a small user base to report issues.

    The Codex also warns that creating a multisite on an existing installation can be problematic due to conflicts with existing permalinks. As long as you are sure site subfolder names do not conflict with post or page names, there shouldn’t be an issue. But if you’ve not verified this yet, it could be a cause of your problem. In any case, some existing permalinks may no longer be valid with multisite because WP requires /blog/ be included in some permalinks. This can result in some broken links, but the site should otherwise work.

    Also be sure when switching to multisite that all plugins are deactivated. You can reactivate later. I would also switch to a default twenty* theme during the transition. I just did a conversion to multisite on a test site that has existed for years and it seems to be working OK. Besides the above mentioned pitfalls, there could be something about your server configuration preventing proper conversion.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Subdomains with WP in subdir – possible or not’ is closed to new replies.