WordPress.org

Support

Support » Multisite » [Resolved] Can't see site without WWW

[Resolved] Can't see site without WWW

  • I installed Multisite, the main site does not load pages/posts without using a www. The subdomains do load pages/posts without a www. I’d like you to be able to access the main site without being forced to insert www. If users don’t insert the www. they’ll be redirected to the wp-signup page.

    I’ve tried changing the wp-config.php file with //define( ‘NOBLOGREDIRECT’, ” ); to //define( ‘NOBLOGREDIRECT’, ‘www.stuffwelike.com’ ); but that didn’t fix the issue.

Viewing 15 replies - 1 through 15 (of 15 total)
  • User registration is also turned off.

    Take the // out of that line 🙂 That means you’re commenting out the line and having it NOT run.

    define( 'NOBLOGREDIRECT', 'www.stuffwelike.com' );

    Didn’t realize that it was commented out. lol

    Now that the line is active, if you try to go to the post/page without a www. you receive the message “The page isn’t redirecting properly.” With a www. the main website still runs fine. Subdomain sites run fine.

    Chrome says The webpage has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

    Do this:

    define( 'NOBLOGREDIRECT', 'http://www.stuffwelike.com' );

    When I try to access a post/page without the www. it now redirects me back to the primary domain name with www.

    Well. Yeah, sadly, that’s how it works.

    Check your DNS to see if you have defined http://www.domain.com in there.

    We may need to use the .htaccess redirect instead, if you want domain.com/foo to go to http://www.domain.com/foo

    I tried inserted the following code into my htaccess, which is what I found that is supposed to redirect non-www links to www links, but nothing changed.

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

    Does it matter where you place that code in the htaccess?

    Yes, it has to be ABOVE the #begin WordPress lines 🙂

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

    Done, still redirects non-www URLs to just stuffwelike.com instead of their www URL posts/pages

    Remove the redirect in wp-config.

    You shouldn’t need both.

    Removed the wp-config redirect.

    If I move that code to the top of the htaccess file, it redirects non-www URLs to www URLS. However my subdomain websites that were created in Multisite do not load their site, they are redirected to the front page of stuffwelike.com.

    UGH. Okay. Try this.

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

    Very cool. That one redirects non-www URLs to www while not affecting the subdomains. Thanks bro! You’ve just fixed a bug that has been around for several months. 🙂

    Yeah, I should have had a brain in my pretty head and flipped it around before 😉

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Resolved] Can't see site without WWW’ is closed to new replies.