• Resolved stuffwelike

    (@stuffwelike)


    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)
  • Thread Starter stuffwelike

    (@stuffwelike)

    User registration is also turned off.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

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

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

    Thread Starter stuffwelike

    (@stuffwelike)

    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.

    Thread Starter stuffwelike

    (@stuffwelike)

    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.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Do this:

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

    Thread Starter stuffwelike

    (@stuffwelike)

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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

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

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

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

    Thread Starter stuffwelike

    (@stuffwelike)

    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 ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

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

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

    (@stuffwelike)

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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Remove the redirect in wp-config.

    You shouldn’t need both.

    Thread Starter stuffwelike

    (@stuffwelike)

    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.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    UGH. Okay. Try this.

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

    (@stuffwelike)

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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    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 ‘Can't see site without WWW’ is closed to new replies.