{"id":166434,"date":"2017-07-22T13:00:33","date_gmt":"2017-07-22T13:00:33","guid":{"rendered":"https:\/\/premium.wpmudev.org\/blog\/?p=166434"},"modified":"2022-02-10T19:54:39","modified_gmt":"2022-02-10T19:54:39","slug":"multisite-subdomains-subdirectories","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/multisite-subdomains-subdirectories\/","title":{"rendered":"WordPress Multisite: Subdomains or Subdirectories?"},"content":{"rendered":"<p>When you activate Multisite on your WordPress installation, there are many things you need to consider, such as whether you&#8217;ll let your users create their own sites, what themes and plugins you&#8217;ll make available on the network, and your registration settings.<\/p>\n<p>But the one decision that&#8217;s challenging to reverse is whether to use subdomains or subdirectories for your network.\u00a0\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/change-multisite-sub-directories-sub-domains\/\" target=\"_blank\">Switching between subdomains and subdirectories<\/a> is time consuming and tricky\u00a0\u2013\u00a0and something best avoided.<\/p>\n<p>It&#8217;s important that you get it right the first time.<\/p>\n<p>In this post, I&#8217;ll\u00a0help you with that, by explaining the differences between WordPress Multisite subdomain and subdirectory installation. I&#8217;ll also look at some scenarios in which you might need\u00a0Multisite, and identify which of subdomains and subdirectories might be better for each. I&#8217;ll also identify those scenarios where you have no choice.<\/p>\n<p>So let&#8217;s start!<\/p>\n<ul>\n<li><a href=\"#difference\">Subdomain vs. Subdirectory \u2013 What\u2019s the Difference?<\/a><\/li>\n<li><a href=\"#new-established\">New vs. Established WordPress Installations<\/a><\/li>\n<li><a href=\"#personal-public\">Personal Networks vs. Public Ones<\/a><\/li>\n<li><a href=\"#redirection\">Domain Redirection<\/a><\/li>\n<li><a href=\"#subdomain\">Hosting Challenges with WordPress Multisite Subdomain<\/a><\/li>\n<li><a href=\"#subdirectory\">Networks Stored in a Subdirectory<\/a><\/li>\n<li><a href=\"#local-remote\">Local vs. Remote Networks<\/a><\/li>\n<li><a href=\"#your-choice\">Your Site, Your Choice<\/a><\/li>\n<li><a href=\"#choosing\">Choosing Between Subdomains and Subdirectories Needn\u2019t Be Difficult<\/a><\/li>\n<\/ul>\n<h2 id=\"difference\">Subdomain vs. Subdirectory\u00a0\u2013\u00a0What&#8217;s the Difference?<\/h2>\n<p>WordPress Subdomains and Subdirectories relate to the structure of the URLs used for each of the sites in your Multisite network. They don&#8217;t correspond to where your server stores\u00a0the sites, but to the way WordPress creates URLs for them.<\/p>\n<figure class=\"wp-caption alignnone\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-1050x1050 size-1050x1050\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/07\/site-on-subdirectory.png\" alt=\"wordpress sister with subdirectory structure shown in url\" width=\"1050\" height=\"368\" \/><figcaption class=\"wp-caption-text\">This demo site on my personal network uses a subdirectory structure.<\/figcaption><\/figure>\n<p>Let&#8217;s say you&#8217;ve got a network called <em>mynetwork.com<\/em>. If you set it up to run on subdomains, a site called <em>myblog<\/em> will have an address of <em>myblog.mynetwork.com<\/em>. But if you set it up to run on subdirectories, then that blog&#8217;s URL will be <em>mynetwork.com\/myblog<\/em>.<\/p>\n<p>A page called &#8216;About Me&#8217; on your <em>myblog<\/em> site will have a URL of <em>myblog.mynetwork.com\/about-me<\/em> on subdomains, while on subdirectories it will be <em>mynetwork.com\/myblog\/about-me<\/em>.<\/p>\n<p>It uses the same structure for every single site in your network\u00a0\u2013\u00a0you can&#8217;t pick and mix. So once you&#8217;ve chosen, they&#8217;ll all be the same.<\/p>\n<p>Which you choose will depend on a few things:<\/p>\n<ul>\n<li>Whether your network is on a new WordPress installation or an established one.<\/li>\n<li>Whether your network is for your personal sites, or sites you will let other people set up or buy.<\/li>\n<li>Whether you&#8217;re using domain redirection.<\/li>\n<li>Your hosting\u00a0\u2013\u00a0can you set up subdomains?<\/li>\n<li>Your site&#8217;s location\u00a0\u2013\u00a0on a local or remote server, or in a subdirectory.<\/li>\n<li>And finally, it will depend in part on your preference.<\/li>\n<\/ul>\n<p>Let&#8217;s look at each of these scenarios.<\/p>\n<h2 id=\"new-established\">New vs. Established WordPress Installations<\/h2>\n<p>If you&#8217;re activating Multisite on a new WordPress installation, then it&#8217;s up to you to decide between subdomains and subdirectories. But if you have an\u00a0established site, you must\u00a0force\u00a0the use subdomains. So, if your site is over a month old, you&#8217;ll have no choice.<\/p>\n<p>This is because there could be a clash between the subdirectory addresses for sites created on your new network, and content you&#8217;ve already added to the site. Imagine you&#8217;ve created a site at <em>mygreatsite.com<\/em> and added a page called &#8220;WordPress is Awesome,&#8221; with the URL <em>mygreatsite.com\/wordpress-is-awesome<\/em>. You then create a Multisite network and let users set up their own sites on subdirectories. Someone comes along and creates a site called &#8220;WordPress is Awesome,&#8221; which would have a URL of\u00a0<em>mygreatsite.com\/wordpress-is-awesome<\/em> (forget about any copyright issues for now). You can see how this would be a problem.<\/p>\n<p>So instead, you&#8217;re forced to use subdomains, and the new site singing WordPress&#8217;s praises would be at <em>wordpress-is-awesome.mygreatsite.com<\/em>. No clash now.<\/p>\n<p>Once you&#8217;ve finished activating Multisite though, you can <a href=\"https:\/\/wordpress.org\/support\/article\/multisite-network-administration\/#switching-network-types\" rel=\"noopener\" target=\"_blank\">switch between subdomain and subdirectory installations<\/a>.<\/p>\n<h2 id=\"personal-public\">Personal Networks vs. Public Ones<\/h2>\n<p>I run three Multisite networks. Two of them are for client sites and one is for personal use. One of them runs on subdomains, which is the one that allows clients to create their own sites. Two run on subdirectories\u00a0\u2013\u00a0one that uses domain redirection (more of which shortly) and the other that&#8217;s my personal site.<\/p>\n<p>The reason I use subdomains for sites created by clients and subdirectories for my sites is twofold. First, subdomains give a more professional feel to the service I offer my clients. Most of them use domain redirection to redirect to my IP address, but I know that if they don&#8217;t, they&#8217;ll have a domain name that starts with their brand, not mine. Second, subdirectories are easier to work with, so that&#8217;s what I use for my site where it&#8217;s less of an issue.<\/p>\n<figure class=\"wp-caption alignnone\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-1050x1050\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/07\/site-on-subdomain.png\" alt=\"Edublogs admin screen showing WordPress Multisite subdomain URL\" width=\"1050\" height=\"495\" \/><figcaption class=\"wp-caption-text\">Edublogs makes it possible for users to create their own sites, so it uses subdomains<\/figcaption><\/figure>\n<p>Using subdirectories means you don&#8217;t have to worry about creating new domains or allowing wildcard domains via your hosting provider, and it just makes things simpler. For me, it also means that the sites in my personal network have URls that mirror the URL in\u00a0their opposite numbers on my local copy of the network. Again, more on that later.<\/p>\n<h2 id=\"redirection\">Domain Redirection<\/h2>\n<p>If all the sites on your network use our invaluable\u00a0<a href=\"https:\/\/wpmudev.com\/blog\/domain-mapping-wordpress-multisite\/\" target=\"_blank\" rel=\"noopener\">Domain Mapping<\/a>\u00a0guide\u00a0to\u00a0redirect their own unique domains to each site, then as far as your visitors go, it doesn&#8217;t matter if you use subdomains or subdirectories. This is because no one\u00a0will ever see the &#8220;real&#8221;\u00a0URL for the sites in your network.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"attachment-600x600 alignnone\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2015\/09\/A-WordPress-Multisite-Network.png\" alt=\"An infographic showing what a WordPress Multisite Network is\" width=\"600\" height=\"317\" \/><\/p>\n<p>So if you&#8217;re creating a network (like one of mine) with sites that will all have domains redirected to them, then use whichever of subdomains or subdirectories you prefer &#8211; or whichever you&#8217;re forced to if that&#8217;s the case.<\/p>\n<p>Personally, I use subdirectories on my network with redirected domains,\u00a0I already outlined.<\/p>\n<h2 id=\"subdomain\">Hosting Challenges with WordPress Multisite Subdomain<\/h2>\n<p>Some hosting providers will make it difficult for you to work with subdomains.<\/p>\n<p>They might charge you extra to set up subdomains on your account, they might not give you access to cPanel where you can set up your own subdomains, or they might not allow wildcard subdomain creation.<\/p>\n<p>A wildcard subdomain is when you create a subdomain called <em>*\/mynetwork.com<\/em>, instead of setting up each subdomain individually. If you&#8217;re using subdomains and offering site creation to your users, then you&#8217;ll need a wildcard subdomain.<\/p>\n<figure class=\"wp-caption alignnone\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-600x600 size-600x600\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/07\/CPanel-domain-editing.png\" alt=\"cPanel domain editing options\" width=\"600\" height=\"201\" \/><figcaption class=\"wp-caption-text\">If you want to use subdomains, you must\u00a0be able to\u00a0edit them in cPanel or a similar system.<\/figcaption><\/figure>\n<p>So if you want to use subdomains, then check first that your hosting provider allows it. If they don&#8217;t, you&#8217;ll either have to use subdirectories &#8211; or switch to a better hosting provider (hint: <a href=\"https:\/\/wpmudev.com\/blog\/introducing-wpmu-dev-hosting\/\" target=\"_blank\" rel=\"noopener\">WPMU DEV Hosting<\/a> supports wildcard subdomains and all of our premium plugins are Multisite compatible too).<\/p>\n<h2 id=\"subdirectory\">Networks Stored in a Subdirectory<\/h2>\n<p>Most Multisite networks are installed in the root directory of your site. This means that if you&#8217;ve bought a hosting plan using <em>mygreatsite.com<\/em>, then that will be the URL for your base site on the network.<\/p>\n<p>But if you&#8217;ve installed WordPress Multisite in a subdirectory, then you can&#8217;t\u00a0use subdomains. So, if you already have a single site installation at\u00a0<em>mygreatsite.com<\/em>,\u00a0and you add another WordPress installation in a subdirectory running Multisite, then its address will be\u00a0<em>mygreatsite.com\/mynetwork<\/em>.<\/p>\n<p>If this is the case, you MUST use subdirectories, meaning that a site you create on your new network will be at\u00a0<em>mygreatsite.com\/mynetwork\/my-new-site<\/em>. Creating a subdirectory would be impossible here, as it would have to be at an address like <em>mygreatsite.com\/my-new-site.mynetwork<\/em>. Which just doesn&#8217;t work.<\/p>\n<h2 id=\"local-remote\">Local vs. Remote Networks<\/h2>\n<p>If you&#8217;re setting up a local Multisite network on your machine, as in the above example, you MUST use subdirectories. This is because a local installation of WordPress will always be in a subdirectory itself &#8211; it will never be in the root directory of your machine.<\/p>\n<p>This is one reason I prefer to use subdirectories remotely. It means that my URLs are as consistent as possible between local and remote versions of my networks, making things easier if I have to migrate the database.<\/p>\n<h2 id=\"your-choice\">Your Site, Your Choice<\/h2>\n<p>I&#8217;ve already stated my preference, which is for subdirectories. But that&#8217;s not to say there aren&#8217;t times when I use subdomains. Networks that allow users to create their own sites will always appear more professional with a subdomain structure. It&#8217;s what we use at <a href=\"https:\/\/edublogs.org\" target=\"_blank\">Edublogs<\/a>.<\/p>\n<figure class=\"wp-caption alignnone\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"attachment-1500x1500 size-1500x1500\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/07\/edublogs.png\" alt=\"edublogs main website\" width=\"1500\" height=\"503\" \/><figcaption class=\"wp-caption-text\">At Edublogs we use subdomains as it&#8217;s better for users<\/figcaption><\/figure>\n<p>If your network doesn&#8217;t have any restrictions on it, and you&#8217;re not forced to use one or other of the two options, then you can go with your preference. But if you will\u00a0host client sites on your network, it also makes sense to consider what their preferences might be, too.<\/p>\n<p>You may also want to check out <a href=\"https:\/\/wpmudev.com\/blog\/wordpress-multisite-subdomain\/\" target=\"_blank\" rel=\"noopener\">Why Subdomains For Multisite Is A Very Bad Idea<\/a> before making a decision.<\/p>\n<h2 id=\"choosing\">Choosing Between Subdomains and Subdirectories Needn&#8217;t Be Difficult<\/h2>\n<p>When you&#8217;re activating Multisite to create your first network and you come across the option for subdomains or subdirectories, it can feel daunting. But if you follow this guide, you should be able to pick the right one for your network, both now and (importantly). There are a few criteria you must\u00a0weigh up, but if you take the time to identify which option is best for your network, then it&#8217;ll save you the lengthy process of switching at a later date.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you activate Multisite on your WordPress installation, there are many things you need to consider, such as whether you&#8217;ll let your users create their own sites, what themes and plugins you&#8217;ll make available on the network, and your registration settings. But the one decision that&#8217;s challenging to reverse is whether to use subdomains or [&hellip;]<\/p>\n","protected":false},"author":761786,"featured_media":166597,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[1117,263],"tags":[9778,9958,10020,11160,11137],"tutorials_categories":[],"class_list":["post-166434","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-multisite","category-tutorials","tag-domains","tag-multisite-2","tag-subdirectory","tag-subdomain","tag-wordpress-multisite-domain-mapping"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/166434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/761786"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=166434"}],"version-history":[{"count":18,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/166434\/revisions"}],"predecessor-version":[{"id":205304,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/166434\/revisions\/205304"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/166597"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=166434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=166434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=166434"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=166434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}