Need www back in domain name (9 posts)

  1. ssaral
    Posted 5 years ago #


    After WP 3.1 multisite installation I lost the www's in my domain. How can I get them back?
    In my browser the URL used to say http://www.example.com but now the URL only shows-up as example.com even if you type http://www.example.com when the site is loaded it returns to example.com. I guess there is a redirect somewhere in the WP code somewhere. I tried to use a .htaccess redirect, like the example below:

    RewriteCond %{HTTP_HOST} !^example.com$
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301]

    But it didn't really work, When you typed example.com, it briefly changed to http://www.example.com, but then it was changed back to example.com when the site loaded. Also, this seemed to break my other subdomain sites (like blog.example.com) which weren't loading properly after the .htaccess edit.

    I seems like I need to change the domain name under Network Admin, Sites, Info but it's grayed out.

    How can I resolve this?

    Thanks, ssaral

  2. This is the code I generally use to redirect non-www URLs to the www version. It sometimes needs slight tweaking depending on the host. Does your host have any support documentation you could check?

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mydomain.com
    RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]

    Your host may also have some server-wide settings that override yours. I recommend contacting them if the above doesn't work.

    There may also be a multisite-specific factor at work here, which I'll let someone else address.

  3. ssaral
    Posted 5 years ago #

    Thanks for your response, I checked with my host (mt) and found the following in their support documentation:

    # To redirect all users to access the site WITH the www. prefix,
    # (http://example.com/... will be redirected to http://www.example.com/...)
    # adapt and uncomment the following:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.mt-example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.mt-example.com/$1 [L,R=301]

    When I added the lines to my .htaccess file the site wouldn't load and I got and error message that read:

    Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

    Could there be an issue with my DNS Zone file? I do have A records in there for example.com, http://www.example.com, and *.example.com. I will contact the host next.

    Thanks, ssaral

  4. Yes, it sounds like there is a conflict somewhere - definitely contact your host for help on this one and see what they say. Good luck!

  5. It's multisite stripping the www.

    Go in the db, look for any fields without it, and add them.

  6. ssaral
    Posted 5 years ago #

    Andrea_r thanks for your reply, can you give me some pointers on where to look in the db? thanks

  7. ssaral
    Posted 5 years ago #

    I got a reply from my host regarding this issue and they said they don't support WordPress, not help here.

    Next, I looked around my db using phpMyAdmin and found 3 tables where the domain name was listed without www's: wp_blogs, wp_site, and wp_sitemeta.

    I added the www's in all 3 of them, then the page wouldn't load again and gave me a "Error 310" as described before. When reverting these changes I noticed that the changes in wp_site and wp_sitemeta didn't really do anything and the change in wp_blogs was causing the error, So I'm thinking there must be some other places where I need to make changes, but I don't know where they are....can anyone help?

    Thanks, ssaral

  8. look in wp-config.php and .htaccess.

  9. ssaral
    Posted 5 years ago #

    OK I made the changes in wp-config.php it had no effect and there are no redirects or any other mentions of the domain name in the .htaccess file. Any other suggestions?

    Thanks, ssaral

Topic Closed

This topic has been closed to new replies.

About this Topic