{"id":2983,"date":"2021-11-02T12:34:14","date_gmt":"2021-11-02T11:34:14","guid":{"rendered":"https:\/\/davidperezgar.com\/?p=2983"},"modified":"2024-08-04T10:46:00","modified_gmt":"2024-08-04T08:46:00","slug":"configure-wordpress-multisite","status":"publish","type":"post","link":"https:\/\/davidperezgar.com\/en\/blog\/configure-wordpress-multisite\/","title":{"rendered":"Configure WordPress Multisite"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A <strong>WordPress Multisite<\/strong> is an installation that shares the same files, and generates different tables according to the different installations and therefore shares functionalities between them. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is a <strong>very smart<\/strong> solution for certain needs such as multi-language sites (like this one), multi-country, division of functionalities to make the main site less cumbersome.\n\n\n\n<p class=\"wp-block-paragraph\">This is because we can create\/install plugins for our different installations. It may happen that we activate an entire online store on a subsite in order to maintain maximum performance on the main portal. This type of installation usually occurs in <strong>very large sites<\/strong>. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide is a compilation of different sites to be able to <strong>install the multisite with the two configurations: subdomains and subfolders.<\/strong> The subdomains option can also be used in the multidomain configuration. It will only be necessary once a subdomain has been created, to change its address to the final one.<\/p> <p><\/p> <p\n\n\n\n<p class=\"wp-block-paragraph\">At Closemarketing we have this <a href=\"https:\/\/davidperezgar.com\/blog\/configurar-wordpress-multisitio\/\">Multisite WordPress Development<\/a> service<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The main site is the <a href=\"https:\/\/wordpress.org\/support\/article\/create-a-network\/\" target=\"_blank\" rel=\"noopener\">Official WordPress HandBook<\/a>, which the first thing it tells us to do is paste this line into the wp-config.php file:<\/p>.\n\n\n\n<div class=\"cbc-code-wrapper\"><div class=\"cbc-code-bar\"><button class=\"cbc-copy-button\">Copy<\/button><\/div><pre class=\"wp-block-code\"><code class=\"\">define( 'WP_ALLOW_MULTISITE', true );<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This will enable a new menu under Tools &gt; Network Administration.\n\n\n\n<h2 class=\"wp-block-heading\" id=\"subfolder-configuration\">Subfolder configuration<\/h2>.\n\n\n\n<p class=\"wp-block-paragraph\">Configuration in wp-config<\/p>\n\n\n\n<div class=\"cbc-code-wrapper\"><div class=\"cbc-code-bar\"><button class=\"cbc-copy-button\">Copy<\/button><\/div><pre class=\"wp-block-code\"><code class=\"\">define('MULTISITE', true);\ndefine('SUBDOMAIN_INSTALL', false);\ndefine('DOMAIN_CURRENT_SITE', 'domain.com');\ndefine('PATH_CURRENT_SITE', '\/');\ndefine('SITE_ID_CURRENT_SITE', 1);\ndefine('BLOG_ID_CURRENT_SITE', 1);<\/code><\/pre><\/div>.\n\n\n\n<p class=\"wp-block-paragraph\">Configuration in htaccess<\/p>\n\n\n\n<div class=\"cbc-code-wrapper\"><div class=\"cbc-code-bar\"><button class=\"cbc-copy-button\">Copy<\/button><\/div><pre class=\"wp-block-code\"><code class=\"\"># BEGIN WordPress Multisite SUBFOLDER.\n&lt;IfModule mod_rewrite.c&gt;\nRewriteEngine On\nRewriteBase \/\nRewriteRule ^index.php$ - [L]\n\n# add a trailing slash to \/wp-admin\nRewriteRule ^([_0-9a-zA-Z-]+\/)?wp-admin$ $1wp-admin\/ [R=301,L]\n\nRewriteCond %{REQUEST_FILENAME} -f [OR]\nRewriteCond %{REQUEST_FILENAME} -d\nRewriteRule ^ - [L]\nRewriteRule ^([_0-9a-zA-Z-]+\/)?(wp-(content|admin|includes).*) $2 [L]\nRewriteRule ^([_0-9a-zA-Z-]+\/)?(.*.php)$ $2 [L]\nRewriteRule . index.php [L]\n&lt;\/IfModule&gt;<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuration-with-subdomains\">Configuration-with-subdomains<\/h2>.\n\n\n\n<div class=\"cbc-code-wrapper\"><div class=\"cbc-code-bar\"><button class=\"cbc-copy-button\">Copy<\/button><\/div><pre class=\"wp-block-code\"><code class=\"\">define('MULTISITE', true);\ndefine('SUBDOMAIN_INSTALL', true);\ndefine('DOMAIN_CURRENT_SITE', 'domain.com');\ndefine('PATH_CURRENT_SITE', '\/');\ndefine('SITE_ID_CURRENT_SITE', 1);\ndefine('BLOG_ID_CURRENT_SITE', 1);<\/code><\/pre><\/div>.\n\n\n\n<p class=\"wp-block-paragraph\">Htaccess if it is a subdomain<\/p>\n\n\n\n<div class=\"cbc-code-wrapper\"><div class=\"cbc-code-bar\"><button class=\"cbc-copy-button\">Copy<\/button><\/div><pre class=\"wp-block-code\"><code class=\"\"><meta charset=\"utf-8\"># BEGIN WordPress Multisite SUBDOMAIN.\n&lt;IfModule mod_rewrite.c&gt;\nRewriteEngine On\nRewriteBase \/\nRewriteRule ^index.php$ - [L]\nRewriteRule ^wp-admin$ wp-admin\/ [R=301,L]\nRewriteCond %{REQUEST_FILENAME} -f [OR]\nRewriteCond %{REQUEST_FILENAME} -d\nRewriteRule ^ - [L]\nRewriteRule ^(wp-(wp-(content|admin|includes).*) $1 [L]\nRewriteRule ^(.*.php)$ $1 [L]\nRewriteRule . index.php [L]\n&lt;\/IfModule&gt;<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"C\u00f3mo crear un WordPress MULTISITE\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/be56X4fhZCg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And another important thing for multisite, is that if we make a mistake with the address and put www or without www, it will redirect to a registration page of the new site. This is rarely used, so we want to disable it, by adding this code in wp-config:<\/p>\n\n\n\n<div class=\"cbc-code-wrapper\"><div class=\"cbc-code-bar\"><button class=\"cbc-copy-button\">Copy<\/button><\/div><pre class=\"wp-block-code\"><code class=\"\">define( 'NOBLOGREDIRECT', 'https:\/\/dominio.com' );<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuration-cookies-for-multidomain\">Configuration cookies for multidomain<\/h2>.\n\n\n\n<p class=\"wp-block-paragraph\">If you want the multidomain option, that is domain.com, domain.es, etc. so that there are no problems with cookies, you will have to add these lines in wp-config:<\/p>\n\n\n\n<div class=\"cbc-code-wrapper\"><div class=\"cbc-code-bar\"><button class=\"cbc-copy-button\">Copy<\/button><\/div><pre class=\"wp-block-code\"><code class=\"\">define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST'] );<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A WordPress Multisite is an installation that shares the same files, and generates different tables according to the different installations and therefore shares functionality between them. It is a very smart solution for certain needs such as multi-language sites (like this one), multi-country, division of functionalities to make the main site less heavy. This is because we can create\/install plugins for our different installations. It may happen that we activate an entire online store on a subsite in order to maintain maximum performance on the main portal. This type of installation is usually done on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4140,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","inline_featured_image":false,"_ayudawp_aiss_exclude":false,"webmentions_disabled_pings":false,"webmentions_disabled":false,"editor_notices":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2983","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/davidperezgar.com\/en\/wp-json\/wp\/v2\/posts\/2983","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davidperezgar.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davidperezgar.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davidperezgar.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davidperezgar.com\/en\/wp-json\/wp\/v2\/comments?post=2983"}],"version-history":[{"count":0,"href":"https:\/\/davidperezgar.com\/en\/wp-json\/wp\/v2\/posts\/2983\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/davidperezgar.com\/en\/wp-json\/wp\/v2\/media\/4140"}],"wp:attachment":[{"href":"https:\/\/davidperezgar.com\/en\/wp-json\/wp\/v2\/media?parent=2983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davidperezgar.com\/en\/wp-json\/wp\/v2\/categories?post=2983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davidperezgar.com\/en\/wp-json\/wp\/v2\/tags?post=2983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}