How to install Wordpress Multisite?

Asked

Viewed 869 times

4

I am using the option of multi-sites Wordpress, but is not working as expected.

I have enabled and created the subdomains, but returns:

Not Found

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

Additionally, a 404 Not Found error was encountered while trying to use an Errordocument to Handle the request.

I believe this problem is happening because:

I have 2 domains

  • domain 1.com is the main domain

  • domain 2.com is an additional domain

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

I thought it was the archive .htaccess, but apparently it’s not:

http://codex.wordpress.org/htaccess

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]

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

  • this . htaccess that you put to the question is your domain or Wordpres Codex?

4 answers

5

I will try to put step by step here everything you need to do to enable the Wordpress multisite. Come on.

Requirements

  • Wordpress 3.0 or higher. (recommend the latest version).
  • Support wildcards in host subdomain creation.

If you need to use WP MS with subdomains, that is, access your websites created in the WP instance using: http://site1.example.com, http:///site2.example.com and so on, your host will need have wildcard support in creating subdomains. Your main website would be on http://example.com and the other sites under that domain.

What are the wildcards?

When you create a host subdomain, 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 of responding to domain calls (requests) to WP. Therefore, you have to create a wildcard domain that answers to any name. This can be done when you create the domain using:

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

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

Create wildcards for subdomains (skip if not using subdomains)

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

If you don’t find this option or the host won’t allow it, open a call asking if you can create a subdomain using wildcards and if so, how you do it. If the host respond negatively, then you will only have the option to create more websites within WP using the sub-directory option, unfortunately.

If you have already created domains from the dashboard and want to use in WP MS, remove these subdomains.

Enabling the WP MS

Created the subdomain settings, we will now enable Multisite in Wordpress. For 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 by browser. Log in to the WP administration and go to Tools > Network Setup.

Choose how to install from sub-domains or sub-folders. Remember the above settings if using subdomains.

Complete the installation by adjusting the wp-config.php and the .htaccess according to the instructions of this temporary page in Tools. tela de configuração do multisite

Altering the wp-config.php

Add these lines after the first one before:

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true ); // <-- depois desta
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'seudominio.com.br');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Altering the .htaccess

Now all that remains is to change the .htaccess because it is a little 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]

After that change the files wp-config.php and .htaccess, will have to login again and will appear the full Network environment.
network menu

Changing the type of sub-domain installation to sub-folders or vice versa

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

define( 'SUBDOMAIN_INSTALL', true );

Use the flag true to use the installation by sub-domains and false to use installation by sub-folders.

Domain mapping

Mapping is to make a Multisite site site work with its own domain, that is, map site.example.com to run as site.com.

Previously it was necessary the plugin Wordpress MU Domain Mapping but nowadays this is native in Wordpress. Just set the site URL with the mapped domain site.com and mapping is done automatically, noting that DNS and SSL should already be working before mapping the domain.


Sources:

0

In Multisite installation 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 an error 404.

I suggest a reading on that codex article. Back up your website, erase everything, and reinstall from scratch by following the step-by-step Codex page.

-2

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

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

  • I contacted them, and they said the folder is: public_html/dominio2.com/meusubdominio . I have to add some file inside the subdomain?

-3

That’s right, buddy, you need something in there so you don’t get 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 the WP itself.

If you do not use Multilanguage, you would have to do so:
en.your.com.br -> Folder with WP Installation in Pt
en.seudominio.com.br -> Folder with WP Installation in En

But here’s how you’re gonna do it:
en.your.com.br -> Folder with single WP installation
en.your.com.br -> Folder with single WP installation

I hope it was helpful, sorry for the delay.

  • 2

    Multilanguage and Multisite are Different Things.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.