Wordpress MU domain mapping doesn't work

Hello everyone, I finally deployed my Hestia - Debian 10 Buster, I’m very proud! I’m thinking of writing a how-to on the subject to help others.

I migrated a Wordpress MU (multisite); installation; main_domain/subsite, without too many problems, it works.

However, then I get a bit lost. Before, on my other VPS, I created an Apache virtualhost manually that I pointed to the Wordpress MU and the domain found its way to the sub-site.

Now with Hestia, I don’t know if I’m doing it right:

I created a Hestia user for the main domain ; democrasite.com

Then, I created a Hestia Site with a Wordpress MU installation with DNS zone creation.

At my registrar, I modified the DNS zone > Hestia_ip

Ok, it works :slight_smile:

For the first sub-site; sandybeearts.com , I also created a Hestia User + a Hestia domain with creation of DNS zones as advised.

Then, at the registrar, I changed the DNS zone of sandybeearts.com (fields A > ip of my Hestia with the main domain)

Normally, the domain mapping should direct the request to the sub-site (democrasite.com/sandybeearts) but it doesn’t work.

Finally, I wonder if I should not have simply created a domain in Hestia for the sub-sites without a Hestia user, besides I don’t necessarily need it, the sub-sites don’t need ftp access. Maybe an email account…

My question is not necessarily directed to Multi-site Wordpress users, but rather to find a logic to solve the problem; as I said, on my old server, I only created Apache Vhosts that pointed to the main Wordpress, but here in Hestia, I don’t really understand if I’m doing it right.

Sorry for this a bit long post, and thanks for your lights.

Translated with www.DeepL.com/Translator (free version)

1 Like

In then next version we have to option to map then new domain to the home folder.

Un til then you will need to edit the template files to make it possible.

1 Like

More likely the additional domains should simply be aliases to the main domain. Wordpress should handle the mapping via rewrite in htaccess. No additional fuzz needed.

2 Likes

Hi eris, thanks for your help.

I know how to do it with apache vhosts, but I guess you have to modify nginx files too? That I know much less about.

You say that you have to modify the “template”; can we duplicate it with Hestia for modifications?

Thanks

@falzo Hi Falzo, very interesting :slight_smile:

Something like in Hestia > domain > aliases ?

1 Like

I wasn’t able to create a SSL certificate when using 2 different domains

mydomain.com and mydomain.net

For templates check https://docs.hestiacp.com/admin_docs/server_management.html#how-do-web-templates-work

1 Like

Ok, thanks

that should not be a problem, use it with multiple different domains and it works properly here.

1 Like

Hi there, it’s me again

Hello, looking at the configuration of a vhost on my current machine, I wonder if it is not enough to simply modify in the apache vhost the “DocumentRoot” and “Directory” directives to tell the domain (sub-site) to redirect to the main domain?

I already have redirection rules in the .htaccess file of the main wordpress :
±-------------------/.htacess--------------------+
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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]
+-------------------------------------------+

here the vhost on my current server :

+------------------vhost (sub-site)-------------------------+
<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName client_domain.com
        ServerAlias www.client_domain.com


        DocumentRoot /var/www/**main-domain**

        <Directory />
                FollowSymLinks options
                AllowOverride All
        </Directory>
        <Directory /var/www/**main-domain**>.
                FollowSymLinks options
                AllowOverride All
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">.
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =**www.client_domain.com** [OR]
RewriteCond %{SERVER_NAME} =**client_domain.com**
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} END,NE,R=permanent] [END,NE,R=permanent]
</VirtualHost>
+------------------end -------------------------+

after of course creating a new web template. But does that mean I have to do it for every domain declared in Hestia?

Thanks for your help.

Configs will be overwritten during updates / upgrades / rebuild commands

1 Like

@eris I just thought that’s what template files were for > custom configurations?

1 Like

Finally I’m not sure I understand the role of the templates and if I really need to modify them to complete my redirections.

What I’m trying to do for my domain mapping problem with Wordpress MU is to modify the Apache directive for the “documentRoot”, and I see that every user created in Hestia with a web space has a Vhost created here:

/home/User_domain/conf/web/User_domain > **apache2.conf and nginx.conf**

Isn’t it possible to change here the arrival address = Master_Domain = MainWordpress?

On the other hand, I see that the root document is also registered in nginx.conf.

Thanks