WordPress.org

Ready to get started?Download WordPress

Forums

How to add www to sites set up as subdomains (2 posts)

  1. converting2wp
    Member
    Posted 9 months ago #

    I am a member of a national organization that is using multisite to provide web sites to their local chapters. I am just an editor of one of the sites, and don't have any information about how things have been set up.

    The local sites are set up with addresses

    local-name.myorg.net

    (for example if the national site were http://www.myorg.org).

    The problem is that trying to reach a local site with the address

    http://www.local-name.myorg.net

    generates an a "domain not found" message. The target audience of the organization is, primarily, "women of a certain age", not a community that thinks about *removing* www as a way to correct the error -- indeed they seem to want to put "www" in front of *every* web address they use (because they first learned about it that way), and can be baffled by an error message from their DNS server.

    Since WordPress.com allows the www prefix and strips it from all of the sites there, I'm guessing there must be a DNS recipe that would do the same for multisite. The IT department at the national organization replies to comments on this with, "We set things up with subdomains, and that's the way WordPress works."

    Anyone have any information or references I can forward to the IT staff? TIA from thousands of baffled folks.

    [I realize this is not primarily a WordPress question, but I figure this is the community that might have a reference. And, yes, I did ask this 8 months ago. But maybe there's a new resource on this. If the answer is "add a line to DNS" for each subsite, that's okay too -- I am primarily looking for some support from this community that I can show to the IT staff.]

  2. So... The answer actually is half 'Add a line to your DNS for each subsite" :)

    See "domain not found" is BEFORE you get to WP so you have to fix that.

    BUT the next thing you have to do is in htaccess, and that's redirect all www.* pages to NON-WWW and since you're using subdomains, it'll need to be something like this:

    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    
    RewriteCond %{HTTPS} on
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

Reply

You must log in to post.

About this Topic

Tags