Subsites in multisite install always redirect to www

I have a multisite installation of wordpress. The main site is http://www.gutzytri.com. We have several subsites as well. If a user types gutzytri.com into a browser, it redirects to http://www.gutzytri.com. When a user types gutzytri.com/team, it also redirects to http://www.gutzytri.com without the /team which is a subsite. I dont really care if it redirects to a www or not, but I do need a user to be able to simply type gutzytri.com/team and have it go to that site and not to http://www.gutzytri.com. I have worked with my hosting provider and they seem unable to determine the issue. I added a phpinfo.php file in the root directory and if i type gutzytri.com/phpinfo.php, the page displays fine but it does not redirect to http://www.gutzytri.com/phpinfo.php.

I am so confused!

I am still fairly new to Wordpress and really having a hard time figuring this out.

  • Phil

    .htaccess:

    # BEGIN iThemes Security
    	# BEGIN Hide Backend
    			# Rules to hide the dashboard
    			RewriteRule ^/xxxxxxxx/?$ /wp-login.php [QSA,L]
    
    	# END Hide Backend
    	# BEGIN Tweaks
    		# Rules to block access to WordPress specific files
    		<files .htaccess>
    			Order allow,deny
    			Deny from all
    		</files>
    		<files readme.html>
    			Order allow,deny
    			Deny from all
    		</files>
    		<files readme.txt>
    			Order allow,deny
    			Deny from all
    		</files>
    		<files install.php>
    			Order allow,deny
    			Deny from all
    		</files>
    		<files wp-config.php>
    			Order allow,deny
    			Deny from all
    		</files>
    
    		# Rules to disable directory browsing
    		Options -Indexes
    
    		<IfModule mod_rewrite.c>
    			RewriteEngine On
    
    			# Rules to protect wp-includes
    			RewriteRule ^wp-admin/includes/ - [F]
    			RewriteRule !^wp-includes/ - [S=3]
    			RewriteCond %{SCRIPT_FILENAME} !^(.*)wp-includes/ms-files.php
    			RewriteRule ^wp-includes/[^/]+\.php$ - [F]
    			RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F]
    			RewriteRule ^wp-includes/theme-compat/ - [F]
    		</IfModule>
    	# END Tweaks
    # END iThemes Security
    <IfModule mod_rewrite.c>
    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).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    </IfModule>

    wp-config:

    <?php
    /** Enable W3 Total Cache */
    define('WP_CACHE', true); // Added by W3 Total Cache
    
    /**
     * The base configurations of the WordPress.
     *
     * This file has the following configurations: MySQL settings, Table Prefix,
     * Secret Keys, WordPress Language, and ABSPATH. You can find more information
     * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
     * wp-config.php} Codex page. You can get the MySQL settings from your web host.
     *
     * This file is used by the wp-config.php creation script during the
     * installation. You don't have to use the web site, you can just copy this file
     * to "wp-config.php" and fill in the values.
     *
     * @package WordPress
     */
    
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'xxxx');
    
    /** MySQL database username */
    define('DB_USER', 'xxxx');
    
    /** MySQL database password */
    define('DB_PASSWORD', ':xxxx');
    
    /** MySQL hostname */
    define('DB_HOST', 'localhost');
    
    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');
    
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    
    /**#@+
     * Authentication Unique Keys and Salts.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
     * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
     *
     * @since 2.6.0
     */
    define('AUTH_KEY',         'xxxx');
    define('SECURE_AUTH_KEY',  'xxxx');
    define('LOGGED_IN_KEY',    'xxxx');
    define('NONCE_KEY',        'xxxx');
    define('AUTH_SALT',        'xxxx');
    define('SECURE_AUTH_SALT', 'xxxx');
    define('LOGGED_IN_SALT',   'xxxx');
    define('NONCE_SALT',       'xxxx');
    
    /**
     * Other customizations.
     */
    define('FS_METHOD','direct');define('FS_CHMOD_DIR',0755);define('FS_CHMOD_FILE',0644);
    define('WP_TEMP_DIR',dirname(__FILE__).'/wp-content/uploads');
    
    /**
     * Turn off automatic updates since these are managed upstream.
     */
    define('AUTOMATIC_UPDATER_DISABLED', true);
    
    /**
     * Multi-site
     *
     */
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    $base = '/';
    define('DOMAIN_CURRENT_SITE', 'www.gutzytri.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    define('WP_ALLOW_MULTISITE', true);
    
    /**#@-*/
    
    /**
     * WordPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each a unique
     * prefix. Only numbers, letters, and underscores please!
     */
    $table_prefix  = 'xxx_';
    
    /**
     * WordPress Localized Language, defaults to English.
     *
     * Change this to localize WordPress. A corresponding MO file for the chosen
     * language must be installed to wp-content/languages. For example, install
     * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
     * language support.
     */
    define('WPLANG', '');
    
    /**
     * For developers: WordPress debugging mode.
     *
     * Change this to true to enable the display of notices during development.
     * It is strongly recommended that plugin and theme developers use WP_DEBUG
     * in their development environments.
     */
    define('WP_DEBUG', false);
    
    /* That's all, stop editing! Happy blogging. */
    
    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');
    /** Added to setup Cronjob Scheduler Plugin */define('DISABLE_WP_CRON', true);
  • Vaughan

    Hi Phil,

    How old is this site? If it's new then the htaccess looks incorrect.

    The wordpress section in the htaccess at the end.

    <IfModule mod_rewrite.c>
    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).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    </IfModule>

    Should look like;

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [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).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    </IfModule>

    If you've had this a while since before wp 3.5, then no need to change.

    But I can't see anything out of place.

    Could you try disabling the cache and security plugins to see if those are interfering. Please be aware, you need to remove the ithemes & w3 cache code from the htaccess & wp-config.php too.

    Hope this helps

  • Phil

    Well, I did some digging and may be on to something here. the home value in the options table is set to http://www.gutzytri.com. in the _blogs table, each of the blog ID's has the domain value set to http://www.gutzytri.com with a different path variable. It looks like when the first site was set up that the home url was http://www.gutzytri.com.

    When I change the home value in the options database, no pages can be displayed and I get a database connection error. presumably this is since there is no gutzytri.com domain in the _blogs table.

    Seems like I may need to treat this as if I have changed the domain name. Do you know of a good procedure to change the domain name on a multisite installation?

  • Jack Kitterhing

    Hi there @Phil,

    Hope you're well today and thanks for the additional information.

    Personally I use https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ for editing a database value in multiple places, as it also works for serialized data.

    Could you send me the following to take a look at the install.

    - In the subject field add "Attn: Jack Kitterhing"
    - Link back to this thread
    - Include admin/network access
    - Include FTP
    - Include any relevant URLS for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Thank you!

    Kind Regards
    Jack.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.