• I recently downloaded the “WordPress Multisite 101” eBook from https://halfelf.org/ebooks/wordpress-multisite-101/ (and yes, I paid for it – money well spent!)

    On page 9 of the eBook, it has the following statement:

    You should not use www in your URL
    A lot of people complain about this. The simple fact is that any well built server will automatically redirect https://www.example.com to example.com seamlessly. By removing it from our install, we avoid any possible con?icts with subdomains. Your SEO will not be impacted.

    I’m a bit confused by this – why exactly is it a bad idea to use www with the Main Site’s URL? Will it actually break multisite or cause specific problems, or is it just a case of “it will work fine but it’s not recommended”?

    I really want to use www with my Main Site’s address, and not by using a redirect either – I want the final URL that is displayed in the browser’s Address Bar to use www, and for that to be used in WordPress.

    If I’m only running a small WP network, with just a handful of subsites which I have complete control over (I’m the one creating all of the subsites myself – other users won’t be able to create their own) – I’m using WP to create a handful of related but distinct sites for a small organisation – if that’s the case, then would there be any problem with me using https://www.example.com for the URL of the main site? Obviously I would use that for both the “WordPress Address” and “Site Address” fields in the settings.

Viewing 8 replies - 1 through 8 (of 8 total)
  • I believe it’s because WordPress Multisite relies on being able to rewrite the virtual URL provided by visitors to find any blog and its physical upload directories.

    If you have the www subdomain as part of the URL, then www. becomes part of the input to the rewrite rules. If, for example, you decided to use www2. instead, the rewrite rules would break.

    What you haven’t excluded here is the possibility of any additional subdomain being required at a later stage, e.g. mail.example.com. That’s the point at which sub-domain conflicts could break your site. You’d then be forced to knit your own rewrite rules, which few can do, give up on using a subdomain, or go back and start again by moving your install to a non-www URL.

    Given that it’s usually almost impossible to predict whether new subdomains may be needed later, it makes sense to learn from others’ experience and avoid using www from the start.

    Thread Starter Jeremy

    (@jfairbrass)

    I’m afraid I don’t quite follow that. What’s wrong with www being part of the rewrite rules? The main site will never use www2 – it will only use www.

    There definitely would be subsites using subdomains, as this will be a subdomain install of Multisite, rather than a subfolder install. But as I’m the super admin, and I will be the sole person creating subsites, I don’t see why that could be a problem. I would set the main site as https://www.example.com and then create my subsites as site1.example.com, site2.example.com, etc (with whatever subdomain I want to use).

    How exactly would subdomain conflicts break my site, as you wrote? If all of the subdomains have unique URLs, which are also different to the main site (www.exacmple.com), then where is the conflict? When a user enters https://www.example.com into his browser, he should get the main site, and when he enters site1.example.com into his browser, he should get the content from that site. Right?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Some servers see www as a subdomain, and not an ‘alias’ (for lack of a better term) of example.com, which is my main reason for not using it.

    I’ve also see a very rare, but infuriating, problem where, after upgrading, a site that HAPPENS to use www in their URL can no longer get to the network admin page, and instead gets a redirection loop. Since this only happens with www in the URL, and never when it’s not, it’s safer to drop the www.

    As I said, a good server always redirects www for you, without any WP finageling. Or you can force it with .htaccess. ??

    (Glad you like the book!)

    ETA: Like I said, a lot of people complain, like you do ‘But I want it!’ If you can give me one really good reason why you have to have it, I’d love to hear it. But you don’t need it, it doesn’t do anything, and it makes your URL needlessly longer.

    Thread Starter Jeremy

    (@jfairbrass)

    Hi Mika, good to hear directly from you! ??

    I’m pretty sure my server (ie. my web host) treats www as a true alias rather than as a subdomain. There’s a place in my web host’s configuration pages where I can specify the target folder on the server for ‘example.com’ (eg. the target folder being public_html), but I don’t need to also specify the target folder for https://www.example.com – it automatically goes to the same target folder as example.com.

    My main reason for wanting to keep www in the URL is because that’s how it’s referenced everywhere else that we refer to it (eg. in print, in emails, etc etc) – the URL, and the current non-WP website, has existed for quite some time, and has always been with www. So for continuity I wanted to leave it like that.

    I know it’s possible and easy to do a redirect from www to example.com. But – correct me if I’m wrong here – isn’t it true that with such a redirection, if I type https://www.example.com into my browser’s Address Bar, the URL will automagically change to https://example.com in the Address Bar after it’s been redirected? So the resulting URL which the end user sees does not have www in it? That’s really my main reason for not wanting to do a redirection – so that the URL which the users see will always have www in it, even in their Address Bar.

    Maybe I need to rethink this and just make the change to removing the www. Or maybe I’ll take a risk and try it with www and see what happens. The jury’s still out for me! ??

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    You’re right, your host would redirect https://www.domain to just domain. The issue comes in with how WordPress parses canonical URLs, rhough, and while I get wanting it so your users have the same experience they always have, I’d put money down that nary a one would notice that https://www.halfelf.org sends you to https://halfelf.org

    People don’t care. (Well, the silly people who DEMAND you type in https://www instead of just halfelf.org do, but that’s browsers, and a different battle. Even IE redirects!)

    The www is the SOLE exception to the rule “Good URLs never change.” Also it’s the only exception to the ‘duplicate content’ rule, because it’s not ‘real.’

    Anyway, do it if you want. BUT if your site breaks after an upgrade and you get that endless loop trying to get to the Network Admin, that’s why. It’s a rare thing, but it’s hell to fix. Not worth the risk to me.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    ETA: I wonder if implementing the ‘fix’ here would protect you… https://core.trac.www.ads-software.com/ticket/9873

    I’m not about to try it, but I’ll keep it in my bag-o-tricks.

    Thread Starter Jeremy

    (@jfairbrass)

    Okay, thanks for the advice, it’s helpful! I’m starting to think that it will be easier to just drop the www, even though the perfectionist in me would prefer not to. Your points about nobody (else) caring are valid. ??

    One thing I do find annoying is how you can type “www.example.com” (without http at the start) into most email clients or Office apps or other programs, and it will automatically be converted into a hyperlink, but that doesn’t work when you just type example.com by itself – with the latter, you have to first type https:// in order for the app to automatically convert it into a hyperlink, and that is a pain to do. But that’s nothing to do with WP of course.

    BTW, I’m racking my brains to figure out what ETA stands for! I haven’t seen that abbreviation before, and I’m stumped! ??

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Edited To Add ??

    Actually, I find “www.example.com” autolinking to be a freakin’ nightmare when I’m trying to debug code in email or forums :/

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Using www with the Main Site's URL’ is closed to new replies.