Ready to get started?Download WordPress


[resolved] Force www on multisite. (8 posts)

  1. Celinal
    Posted 3 years ago #

    I used the following snippet to force www on my domain, and it did seem to work. But all other sites are redirecting back to my main site. E.g blog.mydomain.com goes through http://www.mydomain.com/index.php to http://www.mydomain.com. Now I don't want that. So is there another way to hack the .htaccess file?

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

    Any help will be greatly appreciated!

  2. Just install it when your site is using the www. No need to force anything.

  3. Celinal
    Posted 3 years ago #

    So sorry, but I don't understand what you are saying. I have already installed everything and it is all live. How can I go from there to have www on my domain?

    Thank you for the prompt reply =)

  4. jameshsi
    Posted 3 years ago #

    I need to know this too.

  5. Celinal
    Posted 3 years ago #


  6. What she said was 'If you set up your site, from day one, to be http://www.domain.com, then it'll be fine.'

    Also that .htaccess hack works, but ... I think you want this.

    RewriteCond %{HTTP_HOST} !^mydomain.com$
    RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301]
  7. Celinal
    Posted 3 years ago #

    Thanks for the reply! Yes, I was afraid that is what she meant.

    After many, many failed attempts I figured the code should be placed in the root .htaccess (duh!) since this domain I am talking about is an add-on. Turns out your code works wonders. Everything should be in order now.

    Thank you! I really appreciate your help. :D

  8. Oh yeah, above the WordPress lines in your root .htaccess is best :)

    The only time you'd want to add those to the subdomain .htaccess would be if you want to redirect THAT back around to the MAIN domain (which ... I did recently when I flipped from subdomains to subfolders for another site).

Topic Closed

This topic has been closed to new replies.

About this Topic