WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Can't see site without WWW (16 posts)

  1. stuffwelike
    Member
    Posted 2 years ago #

    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.

  2. stuffwelike
    Member
    Posted 2 years ago #

    User registration is also turned off.

  3. Take the // out of that line :) That means you're commenting out the line and having it NOT run.

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

  4. stuffwelike
    Member
    Posted 2 years ago #

    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.

  5. stuffwelike
    Member
    Posted 2 years ago #

    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.

  6. Do this:

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

  7. stuffwelike
    Member
    Posted 2 years ago #

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

  8. 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

  9. stuffwelike
    Member
    Posted 2 years ago #

    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?

  10. 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]
  11. stuffwelike
    Member
    Posted 2 years ago #

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

  12. Remove the redirect in wp-config.

    You shouldn't need both.

  13. stuffwelike
    Member
    Posted 2 years ago #

    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.

  14. UGH. Okay. Try this.

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

    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. :)

  16. Yeah, I should have had a brain in my pretty head and flipped it around before ;)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.