non-www adress redirects to /premium/?action=new_blog on the main site

Inserting non-www adress redirects to /premium/?action=new_blog on the main site.

  • Kasia Swiderska

    Hello Christoffer,

    Can you check how is redirect to http://www.yoursite.com done? Is www automatic subdomain set in your domain settings or you have done that in the htaccess?
    Can you can post here your htaccess file?

    When you have WordPress multisite and try to access subsite that don't exist it will automatically show new blog form. So it your case your main site is WWW and url without WWW is treated by WordPress as non existing site that why there is redirect.

    kind regards,
    Kasia

  • Christoffer

    Hello Kasia, thank you for your reply. My wordpress installation is in a subfolder, so there are 2 .htaccess

    .htaccess in the root folder:

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

    .htaccess in the subfolder /nordcart

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) nordcart/$1 [L]
    RewriteRule ^(.*\.php)$ nordcart/$1 [L]
    RewriteRule . index.php [L]

    wp-config:

    define('WP_DEBUG', false);
    define('WP_ALLOW_MULTISITE', true);
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'www.nordcart.fi');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    define( 'MS_PROTECT_NETWORK', true );

    (I only included the relevant code from the .htaccess and wp-config)
    The subdomain wildcard is also set in the cpanel.

  • Christoffer

    Hello, as Kasia said, www. will cause problems, the subsites was set as non-www as the main site was set as www, this was causing alot of issues, so I removed the www for the main site, you can do it like this:
    Update 5 database tables and the wp-config file

    Update wp-config.php where DOMAIN_CURRENT_SITE is defined.
    Update wp_site.domain (where id=1)
    Update wp_blogs.domain (where site_id=1 blog_id=1)
    Update wp_sitemeta.meta_value (where site_id=1 meta_key=siteurl)
    Update wp_options.option_value (where option_name=siteurl)
    Update wp_options.option_value (where option_name=home)

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.