[resolved] Stop redirect www.mydomain.com to mydomain.com (5 posts)

  1. plasticgoat
    Posted 3 years ago #

    Hello !

    I have done a fresh install of WordPress Network. I have used my main domain to configure it, ie "http://mydomain.com", because I want to use sub-domain like "http://site1.mydomain.com" (and not http://site1.www.mydomain.com).

    But I also want to access my main blog at "http://www.mydomain.com".
    And so far, WordPress is redirecting "http://www.mydomain.com" to "http://mydomain.com".

    I had my DNS zone configured to redirect "http://mydomain.com" to "http://www.mydomain.com", so I was in an infinite redirection loop. I changed that to be able to access WordPress, but that's not what I want.

    How and where in WordPress settings/files can I change that behavior?

    Thanks :)

  2. Can't have both.

    You can have either http://www.domain.com OR domain.com. I strongly urge you to make it domain.com, as I've seen weird errors with the www and redirect loops.

    Honestly it doesn't matter to SEO, and it doesn't hurt anything to leave it sans-www.

  3. plasticgoat
    Posted 3 years ago #


    Everything is already working fine without the "www". I have access to my main blog on "http://mydomain.com", and sub-domain are working.
    I know it's a detail, it's just a matter of habit I guess, but I prefer having the "www" in my address bar, when it's not a sub-domain :P

    I thought it was possible to set the redirection from "http://mydomain.com" to "http://www.mydomain.com", without configuring WordPress Network on "www.mydomain.com".
    And, as a good programmer, I am curious to know how it would be possible :P

    But it seems the way wordpress is dealing with internal sub-domain is beyond my understanding :)

    So I'll try to deal with it or go back to single wordpress blog installation ...

    Thanks :)

  4. I thought it was possible to set the redirection from "http://mydomain.com" to "http://www.mydomain.com", without configuring WordPress Network on "www.mydomain.com".

    Well... That's not really the same thing :)

    See, Multisite is much more persinkety about where it lives than single site. But even with a single install you only get www or non-www, not both. Never both. WordPress will default to one or the other, and defaulting to non-www is better for Multisite, especially if you want to have site.domain.com later on.

    The internal subdomains is actually pretty simple. You point wildcard subdomains at domain.com's install. Then you make a site called sitename.domain.com. When WP catches that URL (remember, all subdomains are sent to it), it checks your sites and if it finds 'sitename' shows you that.

  5. plasticgoat
    Posted 3 years ago #

    Hi !

    Just to let you know that I have finally been able to do what I wanted :

    - I have WordPress Network configured on non-www domain
    - I have 2 A record (www et non-www) in my DNS Zone pointing to my VPS server IP
    - I have create a sub-domain "www", and that prevent "www.mydomain.com" to be redirected by WordPress to "mydomain.com"
    - I have added 2 rewrite rules in Apache vhost configuration file, to redirect "mydomain" to "www.mydomain.com" except for "/wp-admin/network/

    So I have a blog, in network admin, on "mydomain.com" that I do not use and that is not accessible by its address
    And my main blog on "www.mydomain.com", and accessible by redirection on "mydomain.com" also.

    Everything seems to work fine :D

Topic Closed

This topic has been closed to new replies.

About this Topic