最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

subdomains - Wordpress Multisite with Wildcard Certificates not mapping correctly

programmeradmin1浏览0评论

I have set up a Wordpress Multisite with LAMP successfully and it currently has the following structure

  • a (wordpress primary domain)
    1. a1.a
  • b
    1. b1.b
    2. b2.b
    3. b3.b
  • c

I created virtual hosts configurations for the three domains mapping to the same WordPress Multisite directory, and I am running the WordPress MU Domain Mapping plugging to handle redirections and so far has been working great with http.

Then I created the certificates for https:

  • cert 1 => a, *.a
  • cert 2 => b, *.b
  • cert 3 => c

And set automatic https redirecting in the virtualhost configuration for all the domains.

Current status:

  • a and a1.a are working with https, but a1.a required plugins for redirection from http to https.
  • b is working with https
  • b subdomains are not working with https, pluggins have led to use *.a certificate which results in security warning for all sites.
  • c is working with https.

Can someone please help me understand where can the problem be?

I'm thinking about creating a virtual host configuration for each subdomain in b, but it will be more like a patch than a fix.

I have set up a Wordpress Multisite with LAMP successfully and it currently has the following structure

  • a (wordpress primary domain)
    1. a1.a
  • b
    1. b1.b
    2. b2.b
    3. b3.b
  • c

I created virtual hosts configurations for the three domains mapping to the same WordPress Multisite directory, and I am running the WordPress MU Domain Mapping plugging to handle redirections and so far has been working great with http.

Then I created the certificates for https:

  • cert 1 => a, *.a
  • cert 2 => b, *.b
  • cert 3 => c

And set automatic https redirecting in the virtualhost configuration for all the domains.

Current status:

  • a and a1.a are working with https, but a1.a required plugins for redirection from http to https.
  • b is working with https
  • b subdomains are not working with https, pluggins have led to use *.a certificate which results in security warning for all sites.
  • c is working with https.

Can someone please help me understand where can the problem be?

I'm thinking about creating a virtual host configuration for each subdomain in b, but it will be more like a patch than a fix.

Share Improve this question asked May 11, 2019 at 13:56 Byron QuezadaByron Quezada 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

It seems that I was getting wrong the virtual host configuration file to redirect all http requests to https

This is my current working configuration:

/etc/apache2/sites-available/a.conf

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName a
    ServerAlias *.a
    DocumentRoot /var/www/a/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =a1.a [OR]
RewriteCond %{SERVER_NAME} =a
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

/etc/apache2/sites-available/a-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin [email protected]
    ServerName a
    ServerAlias *.a
    DocumentRoot /var/www/a/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/a/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/a/privkey.pem
</VirtualHost>
</IfModule>

However it is required to update the virtual host configuration RewriteCond %{SERVER_NAME} =a1.a [OR] for every subdomain I need, therefore the process is not automated.

发布评论

评论列表(0)

  1. 暂无评论