{"id":730,"date":"2011-06-29T19:50:57","date_gmt":"2011-06-29T17:50:57","guid":{"rendered":"http:\/\/patchlog.com\/?p=730"},"modified":"2011-11-03T11:40:46","modified_gmt":"2011-11-03T09:40:46","slug":"multisite-in-subfolder","status":"publish","type":"post","link":"https:\/\/patchlog.com\/wordpress\/multisite-in-subfolder\/","title":{"rendered":"WordPress multisite in subfolder"},"content":{"rendered":"<p>If you install wordpress in a subfolder like \/home\/example\/public_html\/wordpress instead of the main DocumentRoot ( usually \/home\/example.com\/public_html  ) you will not be able to enable multisite functionality but with a few small changes to wordpress code you can make it work.<\/p>\n<p>My goal was to have the main site ( example.com ) with multisite, host blogs on subdomains like dom1.example.com and then use domain mapping so I could map a domain like dom1.com to dom1.example.com. <\/p>\n<p>Here are the steps I took:<\/p>\n<ol>\n<li>Extract wordpress-3.1.3.zip in \/home\/example.com\/public_html\/wordpress, go to went to http:\/\/example.com\/wordpress and install, then login as admin to http:\/\/example.com\/wordpress\/wp-admin<\/li>\n<li>In wp-admin -&gt; Settings both WordPress address (URL) and Site address (URL) were set to http:\/\/example.com\/wordpress, change Site address (URL)  to http:\/\/example.com<\/li>\n<li>copy index.php and .htaccess from \/home\/example.com\/public_html\/wordpress to \/home\/example.com\/public_html\/<\/li>\n<li>open \/home\/example.com\/public_html\/index.php in an editor and changed the line:<br \/>\n<code>require('.\/wp-blog-header.php');<\/code> to <code>require('.\/wordpress\/wp-blog-header.php');<\/code><br \/><strong>At this point you have a working wordpress installed in a subfolder accessible at http:\/\/example.com <\/strong><\/li>\n<li>Open wp-config.php and insert the following lines at the top ( can be right after the first line )<br \/>\n<code>define('WP_ALLOW_MULTISITE', true);<\/code><\/li>\n<li>Open the file wordpress\/wp-admin\/network.php in a text editor, look for the line: \"function network_step1\" and a few lines bellow there should be a line:\n<pre><ol><li style=\"font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;\"><div style=\"font-family: 'Courier New', Courier, monospace; font-weight: normal;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<p>, replace it with<\/p>\n<pre><ol><li style=\"font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;\"><div style=\"font-family: 'Courier New', Courier, monospace; font-weight: normal;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<\/li>\n<li>Now go to http:\/\/example.com\/wordpress\/wp-admin\/network.php and create your network.<\/li>\n<li>After you create the network, WordPress will ask you to add a few lines to wp-config.php but you'll have to modify them a bit. Here's what I added:\n<pre><ol><li style=\"font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;\"><div style=\"font-family: 'Courier New', Courier, monospace; font-weight: normal;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<p>By default SUBDOMAIN_INSTALL was set to false but you want subdomains, and $base was set to \"\/wordpress\" but this needs to be \"\/\"<\/p>\n<p>Don't forget to also add the required lines to .htaccess ( the one in the wordpress\/ directory )<\/li>\n<li>After the network was created, wordpress messed up a bit with the permalink settings for the main domain. Before, the permalink structure was set to: \/%year%\/%monthnum%\/%day%\/%postname%\/ and wordpress changed it to \/blog\/%year%\/%monthnum%\/%day%\/%postname%\/.<br \/>\nBut after I added the above lines to wp-config.php I was able to change the permalink structure back to what it was from Settings-&gt;Permalinks<\/li>\n<li><strong>Adding domains<\/strong>\n<p>Go to Network admin ( http:\/\/example.com\/wordpress\/wp-admin\/network\/ ) -&gt; Sites -&gt; Add new . I added<br \/>\nan example domain dom1.example.com. This is what I'll use as an example from now on.<\/p>\n<p>After I added the domain I went to Sites , clicked the Edit  link bellow the domain and changed Path from \/ to \/wordpress ( with the option \"Update siteurl and home as well\"  checked ) then go to the Settings tab and change the Home to http:\/\/dom1.example.com\/<br \/>\n<strong>At this point you have a working wordpress installed in a subfolder with multisite configured with subdomains.<\/strong><\/li>\n<li>Install the <a href=\"http:\/\/patchlog.com\/wordpress\/wpmu-domain-mapping-in-subfolder-install\/\">domain mapping plugin with my changes<\/a>\n<ul>\n<li>Download the zip file from : <a>http:\/\/patchlog.com\/wordpress\/wpmu-domain-mapping-in-subfolder-install\/<\/a><\/li>\n<li>Extract in  wp-content\/plugins<\/li>\n<li>\n<pre><ol><li style=\"font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;\"><div style=\"font-family: 'Courier New', Courier, monospace; font-weight: normal;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<\/li>\n<p>edit wp-config.php and add the line:<\/p>\n<pre><ol><li style=\"font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;\"><div style=\"font-family: 'Courier New', Courier, monospace; font-weight: normal;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<p>right after the first line<\/p>\n<li> got to Network Admin -&gt; Tools -&gt; Domain Mapping to configure the plugin and add the mappings<\/li>\n<\/ul>\n<\/li>\n<li>Come back and let me know how it worked in the comments<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>If you install wordpress in a subfolder like \/home\/example\/public_html\/wordpress instead of the main DocumentRoot ( usually \/home\/example.com\/public_html ) you will not be able to enable multisite functionality but with a few small changes to wordpress code you can make it work. My goal was to have the main site ( example.com ) with multisite, host &hellip; <a href=\"https:\/\/patchlog.com\/wordpress\/multisite-in-subfolder\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">WordPress multisite in subfolder<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[12],"tags":[318,317,319,360,359],"class_list":["post-730","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-domains","tag-mapping","tag-multisite","tag-patches","tag-wordpress"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pofPh-bM","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts\/730","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/comments?post=730"}],"version-history":[{"count":6,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts\/730\/revisions"}],"predecessor-version":[{"id":733,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts\/730\/revisions\/733"}],"wp:attachment":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/media?parent=730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/categories?post=730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/tags?post=730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}