WordPress multisite setup as subdomain - wildcard DNS record setup
Asked Answered
R

1

2

I am new to WP multisite environment. I want to setup multisite in my local Ubuntu 14.04 environment. I already have localhost for my main site configured as carbazarlocal.com and its running OK. When I go to Tools > Network Setup I can see two options - Sub-domain and Sub-directory. I want to setup my multisites as sub-domains like dealer1.carbazarlocal.com, dealer2.carbazarlocal.com etc.

On this page WordPress says "You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality". How to do this and where?

In /etc/hosts I have the following entry:

127.0.0.1   carbazarlocal.com

In /etc/apache2/apache2.conf I have the following:

<Directory /var/www/html/carbazar>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

In /etc/apache2/sites-available/carbazarlocal.com.conf I have this:

<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName carbazarlocal.com
     ServerAlias *.carbazarlocal.com
     DocumentRoot /var/www/html/carbazar
</VirtualHost>

And in /var/www/html/carbazar/wp-config I have this:

define('WP_ALLOW_MULTISITE', true);

What else I need to do and where to complete the following step: "You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality"?

Racing answered 17/3, 2017 at 12:1 Comment(1)
Hey ! did you manage to find any solution ? :')Salchunas
L
1

If you use Apache server then ...

In the httpd.conf file, or in the include file containing the VirtualHost section for your web account, add a line like this (if it is not already present):

ServerAlias *.example.com

Also create a wildcard DNS record like:

*.example.com A 192.0.43.10

REF https://codex.wordpress.org/Configuring_Wildcard_Subdomains
Lablab answered 24/5, 2017 at 12:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.