Score:0

WordPress Multisite - Change Main Site from no-www to www

gb flag

I've started issuing automated wildcard SSL-Certificates over the acme-dns-client. While having an easy way to cover all of my subdomains together, I'm having the issue to not have, any coverage for my no-www domain.

Therefore I thought it could be an good idea, to just change the no-www Mainsite to www.example.net instead of example.net


Does anyone has suggestions how to change these settings, because they are not available into the Wordpress Multisite Admin Dashboard, here you can just change the subdomains for subpages.


I've already tried to just add following line into the wp-config.php.

define('WP_HOME','https://www.example.net');
define('WP_SITEURL','https://www.example.net');

But this didn't worked out yet. I'm using nginx as my root webserver system.


Nginx Config

server {
   location / {
            try_files $uri $uri/ /index.php?$args;
            }

            location ~ \.php$ {
                         include snippets/fastcgi-php.conf;
                         fastcgi_pass unix:/run/php/php7.4-fpm.sock;
             fastcgi_connect_timeout 300s;
                 fastcgi_read_timeout 300s;
                 fastcgi_send_timeout 300s;
            }

            location ~ /\.ht {
                         deny all;
            }

            location = /favicon.ico {
                         log_not_found off;
                         access_log off;
            }

            location = /robots.txt {
                         allow all;
                         log_not_found off;
                         access_log off;
           }

            location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                         expires max;
                         log_not_found off;
           }

        root /var/www/wordpress;
        index index.php;

        server_name example.net www.example.net get.example.net *.example.net;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    #settings for file upload
    client_max_body_size 32M;
}

server {
    if ($host = example.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80;

        server_name example.net *.example.net;
    return 404; # managed by Certbot


}
Paul avatar
cn flag
I'm not sure if there is a way to have WordPress determine which URL to serve, but for nginx you will need to post your current configuration.
djdomi avatar
za flag
i dont know, how you think about the future of www on a url, already been since years it has became the standard that www is not more required and furthermore it is not more shown...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.