• Resolved ubergiant

    (@ubergiant)


    All non-www pages of my WordPress multi-site redirect to the www version of the home page. I’ve tested multiple WordPress themes to rule out my theme and the same issue occurs. It also occurs on other sites within the multisite installation.

    I have found a similar issue, but no solution that works for me:
    https://wordpress.org/support/topic/missing-www-from-our-url?replies=16

    Here is my WordPress .htaccess file:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    # END WordPress

    I also test the following after RewriteRule ^index\.php$ – [L] to no avail:

    # BEGIN NON-WWW REDIRECT TO WWW
    RewriteCond %{HTTP_HOST} ^domain.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC]
    # END NON-WWW REDIRECT TO WWW

    These are unusual settings at the bottom of this existing install that I don’t have on other standard WP installs:

    define('MULTISITE', true);
    define( 'SUBDOMAIN_INSTALL', false);
    $base = '/';
    define('DOMAIN_CURRENT_SITE', 'www.domain.com.au');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    	require_once(ABSPATH . 'wp-settings.php');

    The site is WordPress 4. I thought WordPress itself should automatically do the non-www redirect out of the box if it has the domain setup. Do you have ideas as to what is causing the issue or ways to diagnose?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Dee Teal

    (@thewebprincess)

    What are the HOME URL and the SITE URL settings in Admin >> Settings >> General settings set to?

    http://codex.wordpress.org/Changing_The_Site_URL

    Thread Starter ubergiant

    (@ubergiant)

    It’s a multisite. There’s no such option…

    “All non-www pages of my WordPress multi-site redirect to the www version of the home page.”

    1st:

    I guess, you should not mix up pages / blogs with and without http://www.prefix.

    2nd:

    It seems to be important, that the removing of the http://www.-prefix from the server settings is done correctly.

    (I had a similar problem, which is now resolved. But unfortunately I still do not understand, what was precisely the mistake, which my provider did at first regarding the server settings, and what was finally the solution for resolving the problem.
    Cfr. – unfortunately only in German:

    http://forum.wpde.org/blog-netzwerk/132360-umleitungsfehler-kein-loggin-moeglich.html#post576489
    and
    http://forum.wpde.org/blog-netzwerk/133384-kein-zugang-zum-netzwerk-dashboard.html#post576525.)

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    It’s a multisite. There’s no such option…

    There is, it’s just not where you think.

    First, put this ABOVE the BEGIN WORDPRESS lines

    # BEGIN NON-WWW REDIRECT TO WWW
    RewriteCond %{HTTP_HOST} ^domain.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC]
    # END NON-WWW REDIRECT TO WWW

    Always above 🙂

    Second, go to your database and look up the wp_blogs and wp_sites tables. See if you have www and non-www mixed up in there.

    Thread Starter ubergiant

    (@ubergiant)

    I guess, you should not mix up pages / blogs with and without http://www.prefix.

    It’s predominately www, but that’s beside the problem. The two links you provided have nothing to do with the issue at hand.

    @ipstenu The one site in wp_site has the www entry for the domain. The wp_blogs has my 3 sites which all have the www in their domain.

    Tried the .htaccess addition above before and again then as mentioned, no affect.

    Thread Starter ubergiant

    (@ubergiant)

    Anyone have further ideas about this issue?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Tried the .htaccess addition above before and again then as mentioned, no affect.

    You changed domain.com to your domain, right?

    Does your webhost have any settings to allow you to force www or non-www?

    Thread Starter ubergiant

    (@ubergiant)

    You changed domain.com to your domain, right?

    Of course.

    I’m not familiar with any such option. I have other domains on the same account with separate WP installs and they have no problem with the redirects. They are, however, not multi-site.

    Thread Starter ubergiant

    (@ubergiant)

    Got it fixed thanks to my helpful webhost:

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

    Thanks @ubergiant!

    Thanks for the solution but I think this should be escalated to a bug, as we shouldn’t need to edit htaccess to solve WP multisite issues.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘All non-www pages redirect to the home page’ is closed to new replies.