Хей, имам нещо специално за теб!
Попълни имейл адрес, на който до минута ще получиш обещаното ;)
A WordPress network environment allows you to have a main website where you can have installations of the CMS, or in other words, child websites. There are many pros and cons, so it’s important to consider them before opting for such a solution. The most common reason for having a network is the ability to administer multiple websites under one “umbrella” (e.g., online stores for different countries, blogs in different languages, etc.).
The child websites have access to all installed themes and plugins in the network, but each of them has its own separate content.
With the explanation of what WordPress Network represents, I assume that if you’re reading this post, you are already familiar with it, and what you are looking for is specifically…
Here is the answer:
This is a built-in functionality of WordPress, and the only thing you need to do is add the following two lines to the wp-config.php file, after the line /* That’s all, stop editing! Happy blogging. */:
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
What the code does is simply activate the WordPress multisite functionality. After adding and saving it in the wp-config.php
file, there are a few more steps to follow:
.htaccess
and wp-config.php
. Here’s an example of how they may look:// wp-config.php
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'DOMAIN_CURRENT_SITE', 'yourprimarydomain.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
// .htaccess
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
With these changes, you are essentially informing WordPress about the domains you want to use and overriding the previous settings in the .htaccess
file.
That’s it! You can now log back into your network administration and start creating child sites.
Stay blond 😉