How to install WordPress Multisite?

3

I'm using the WordPress multi-site option, but it's not working as expected.

I have already enabled and created the subdomains, but it returns:

  

Not Found

     

The requested URL /index.php was not found on this server.

     

Additionally, a 404 Error was encountered while trying to use an ErrorDocument to handle the request.

I believe this problem is happening because:

I have 2 domains

  • domain1.com is the primary domain

  • domain2.com is an additional domain

WordPress is installed on the additional domain and in this domain I created the subdomains.

I thought it was the .htaccess file, but apparently it is not:

link

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

Generate error 404, because there are no files inside the subdomain. What do I have to do to fix this?

    
asked by anonymous 19.02.2015 / 14:42

4 answers

4

I'll try to put step by step here everything you need to do to enable WordPress Multisite . Come on.

Requirements

  • WordPress 3.0 or higher. (I recommend the latest version).
  • Wildcard support for subdomain creation by the host.

If you need to use WP MS with subdomains, that is, access your sites created in the WP instance using: http://site1.example.com , http:///site2.example.com and so on, your host will need wildcards support in creating subdomains . Your primary site would stay in http://example.com and the other subdomain sites in that domain.

What are wildcards?

When you create a subdomain under host, you usually specify the name of the subdomain and the root folder it should read. For example:

  • http://site1.example.com - /home/seuusuario/site1/public_html
  • http://site2.example.com - /home/seuusuario/site2/public_html

However, you will need to transfer this responsibility from responding to domain requests to WP. So you have to create a wildcarded domain, which responds to any name. This can be done when you create the domain using:

  • *.example.com - > /home/seuusuario/example.com/public_html

In this way, any request made before example.com will be forwarded to the WP installed in the /home/seuusuario/example.com/public_html folder. If WP is configured as MS it will respond with the due site created within MS.

Create wildcards for subdomains (skip if not using subdomains)

As explained above, you will have to access the control panel of your host and create a subdomain with the name of *.example.com or, depending on the host, %.example.com . Point the DocumentRoot to the folder where your WP installation is located or where you will install WP.

If you do not find this option or the host does not allow it, open a call asking if it is possible to create a subdomain using wildcards and if it is, just like you do. If the host responds negatively, then you will only have the option to create more sites within WP using the sub-directories option , unfortunately.

If you have already created domains through the dashboard and want to use them in WP MS, remove those subdomains.

Enabling WP MS

Created subdomain settings, let's now enable Multisite in WordPress. To do this, open the file wp-config.php and add the following line:

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );

Save the file, and access your WordPress through the browser. Log in to WP admin and go to Tools > Network Setup .

Choose how to install between sub-domains or sub-folders . Remember the above settings if you use subdomains.

Finish the installation.

Changing the .htaccess

Now we only need to change the .htaccess because it is a bit different when used with WP MS. Open your .htaccess and replace it all with the following content according to the type of your installation:

Sub-domains

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ wp/$1 [L]
RewriteRule . index.php [L]

Sub-folders

RewriteEngine On
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]

Made the changes, clear the caches and test.

Changing the subdomain installation type to subfolders or vice versa

If you want to change the installation type from one type to another after you have done an installation, do the following. Open the file wp-config.php and modify the following line:

define( 'SUBDOMAIN_INSTALL', true );

Use the true flag to use sub-domain installation and false to use sub-directory installation.

Domain mapping

To make a Multisite site work with a domain of its own, that is, to map site.example.com to run as site.com , you need the following plugin:

  

WordPress MU Domain Mapping
  Map any blog / site on a WordPressMU or WordPress 3.X network to an external domain.

Sources:

22.10.2015 / 09:09
0

When installing Multisite with subdomains you do not need to create subdomains. If you create them your server will direct you to the subdomain, which is empty and will give a 404 error.

I suggest reading this Codex article . Make a backup of your site, delete everything and reinstall from scratch, following the step-by-step Codex page.

    
13.03.2015 / 13:29
-2

Do you have access to Shell? If so, give a tailf /var/log/apache/access.log to see which folder the browser is arriving at.

It seems that the problem is domain targeting, the folder where it is being directed is not the folder the wp is installed on. Just a suggestion.

    
19.02.2015 / 16:27
-3

That's right, buddy, you need something inside so you do not give Not Found. But in your case, as I understand it, you need to make this subdomain fall into the same folder as the current domain, because who will deal with it will be WP itself.

If you do not use multilanguage, you would have to do this:
en.yourdomain.com - > Folder with WP Installation in Pt
in.yourdomain.com - > Folder with WP Installation in


However, it will do so:
en.yourdomain.com - > Folder with the only installation of WP
in.yourdomain.com - > Folder with the only WP installation

I hope it was helpful, sorry for the delay.

    
21.02.2015 / 05:47