Webinoly is just the perfect tool for NGINX experts. Give it a try!
0 votes
1.5k views
by
edited
Thanks to admin for help with my Multisite install. I was having redirect issues.

Following his suggestion, after installing Multisite login to Wordpress Admin area, go to "Tools -> Network Setup" to setup "sub-domain" or "sub-directory" for your Multisites.

*BEFORE YOU DO THAT.

Go to "Settings -> General" and change your main-site URL, delete "www" from the site URL. This was causing me redirect problems. I'm not sure why it adds "www" to the main-site URL? I setup my Wordpress Multisite with "example.com" domain, and not "www.example.com" domain.

Is this correct for Multisite installs, or did I do something wrong for this to happen? Thanks admin for all your help.

Continuing on, can you give advise for site redirect. I would like my main site to have "www", so "www.example.com", but for all subdomain sites, no need for "www", I would like "sub1.example.com" and "sub2.example.com". I've tried unsuccessfully to do this.

1 Answer

0 votes
by Expert

I've been trying to reproduce your issue (www added), but seems like everything is OK, site is created with the same domain as it was created. I can't reproduce the behavior you are experiencing.

On the other hand, what you are trying to do with redirects used to be achieved with Domain Mapping plugin, but now this feature is build-in as a WP native feature.

https://codex.wordpress.org/WordPress_Multisite_Domain_Mapping

In your case, create the main site with "www" and all the subsites you just update the domain as is explained in codex. You should create a "Subdir Multisite" and subsites should be configured with new domains (in this case subdomains of your main site/domain).

by
I did two seperate installs of sub-domain Multisite, and both times I had the redirect issue.

If I add the "www" when creating the site, Wordpress advises to delete the "www" from the domain name in "Network Setup". This makes sense because otherwise all the sub domains would be "subdomain.www.example.com", and I want "subdomain.example.com".

The way around this, I installed Multisite sub-domain without "www". After installation, I edit the URL for the primary domain in phpMyAdmin, in tables "wp_options"and "wp-sitemeta". So, this way, the primary site has "www", but all sub-domain sites are without "www".

For the redirect, I added the following at the top of the site conf file "/sites-available/example.com":

server {
        listen 80;
        listen [::]:80;

        server_name  example.com;
        rewrite ^(.*) $scheme://www.example.com$1 permanent;
}
by Expert
Hacking the DB doesn't sound like a good idea.

I think Multisite SubDir and native Domain Mapping should be better in this case.
by
I need sub-domain, not sub-directory! Changing the URL for the primary site is working fine so far. Unless there are another suggestions?

Seems it's either Wordpress issue, or Nginx conf file issue not being able to set it up the way I describe without database editing.
by Expert
  1. Did you read the link about Domain Mapping? (Seems like you don't)
  2. As I said before, I can not reproduce the issue you describe, everything is working just fine, unless you provide more details to verify. Redirect issues can be caused by a lot of things (Nginx, WP, your DNS settings, Browser Cache, etc.)
by

Yes, I did read your link about domain mapping! Not much help for my issue!

I'm surprised you describe changing the primary domain name from the database as "hacking"! This is a method suggested by Wordpress: https://codex.wordpress.org/Changing_The_Site_URL. It's working fine for me, so I guess I'll stick with this way seeing as you have nothing to offer for alternate solutions.

Thanks for your effort. Moving forward, I'll post any future questions on EasyEngine or Centmin Mod forums, they seem to be more active and knowledgable.

by Expert

Just for the record.

  1. Domain Mapping is maybe the best option to achieve what you want. Neither Subdir, nor subdom will behave as you want. "www.domain.com" is your main site and "subX.domain.com" will be your mapped domains.
  2. Manually change values in DB is for advanced users. You could get unexpected behaviors.
  3. You arrive here to report a possible bug in Webinoly and never gave the details to reproduce the behavior you were experiencing.

Insults are not welcome here, this is a Support Forum for Webinoly, not for WP. If you want to learn basic things about WP you are free to go wherever you want.

Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

To report a bug, please create a new issue on GitHub or ask a question here with the bug tag.
Webinoly Support Paypal Donations

PayPal · GitHub Sponsors · Bitcoin

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.

...