0

We are developing a WordPress multisite (group of 5 subsites) and we are facing this problem. We developed the multisite as http://wpsite.com/sub1, http://wpsite.com/sub2,... etc. Now we want to access these sites as sub1.mainsite.com, sub2.mainsite.com and mainsite.com is already a working stand-alone website.

We have checked many articles and questions but could not find a suitable solution.

We have tried doing a permanent redirect from sub1.mainsite.com that points to http://wpsite.com/sub1, however, the URL changes in the address bar which is not we want.

What is the best way to solve this problem? Please help.

1 Answer 1

0

With a little leg work you can convert a subfolder wp network into a subdomain wp network. I've done it myself so I know its possible. Easiest approach would be to

  • backup files and database
  • give yourself a cushion of time to deal with problems
  • review the network setup instructions for sub-domain,
  • properly point your subdomains to the wordpress folder
  • make the subdomain changes in admin > Network Setup, wp-config, and htaccess
  • use WPCLI to find+replace on database (old subfolder to new subdomain)
  • troubleshoot any issues (hard coded urls, missing images, browser cached 301's, serialized strings -- depends on your setup)

Here's an article on it:


Alternatively, (this is more of a round-about solution), but you can look at each sub-domain as simply another domain (because really thats all they are). Properly point your subdomains to your wordpress folder. You can then domain-map your subfolder sites to a sub-domain by changing each sites Site URL to the sub-domain or by using a domain mapping plugin.

8
  • Thank you David, the solution you have mentioned is about changing the subfolder pattern to subdomain pattern which in my case wpsite.com/sub1 will become sub1.wpsite.com. I want something that it should change to sub1.maindomain.com where my maindomain is different from wpsite. Are you getting me? Commented Dec 21, 2017 at 18:16
  • My apologies for misunderstanding. But if thats the case, my second answer applies, just domain map it then. Commented Dec 21, 2017 at 18:20
  • I already have websites running on sub1.maindomain.com and we deployed the wordpress multisite on wpsite.maindomain.com/sub1, sub2 etc. Now we want those new sites to be accessed from the previous subdomain "sub1.maindomain.com" should point to "wpsite.maindomain.com/sub1" and likewise for other subsites. Commented Dec 21, 2017 at 18:23
  • with domain mapping you can point any subdomain to any wordpress install in a network. Point the A record and vhost settings for sub1.maindomain.com to your new wpsite.maindomain.com's wordpress network setup. Install domain mapping plugin on your new network. Via Domain Mapping Network Settings, set wpsite.maindomain.com/sub1's primary domain to sub1.maindomain.com. (sub1.maindomain.com will then render wpsite.maindomain.com/sub1 and the url will stay as sub1.maindomain.com). Commented Dec 21, 2017 at 18:33
  • okay, thanks. Are you referring to use this plugin Domain Mapping ? With this plugin, won't there be any permanent redirect of the subdomain but will change the A records of the subdomain, right? Commented Dec 21, 2017 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.