5

I have recently installed a Wordpress Multisite Blog on my domain.

Everything is working fine, except for wp-admin of the subsites:

I can access wp-admin of a subsite, but css is not loaded and when I try to click on a navigation link I get the wordpress "File not found" error.

That is because it links to e.g. domain.com/subsite/wp-admin/post-new.php - which does not exist. (domain.com/wp-admin/post-new.php exists)

I also think that css does not work, domain.com/subsite/wp-admin/load-styles.php and load-scripts.php cannot be found

Here is one of the errors I get in the chrome developer tools when visiting /subsite/wp-admin

enter image description here

I am using the standard .htaccess that is pasted everywhere:

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

I guess the error must be here, right?

Here is wp-config - just in case:

<?php

 define('WP_ALLOW_MULTISITE', true);

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'XXX');

/** MySQL database username */
define('DB_USER', 'XXX');

/** MySQL database password */
define('DB_PASSWORD', 'XXX');

/** MySQL hostname */
define('DB_HOST', 'XXX');

/** 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', XXX);
define('SECURE_AUTH_KEY',XXX);
define('LOGGED_IN_KEY',XXX);
define('NONCE_KEY',        XXX);
define('AUTH_SALT',        XXX);
define('SECURE_AUTH_SALT', XXX);
define('LOGGED_IN_SALT',   XXX);
define('NONCE_SALT',       XXX);
/**#@-*/

/**
 * 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';

/**
 * 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.
 *
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define('WP_DEBUG', false);


define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'mydomain.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);




/* 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');

define( 'WP_ALLOW_MULTISITE', true );

define ('FS_METHOD', 'direct');
?>

1 Answer 1

4

If you installed WordPress Multisite starting with version 3.0 to 3.4.2, you've got the correct .htaccess file contents.

However, if you started with a newer version (3.5 or higher)—and I'm assuming you did, if you've just installed WordPress Multisite recently—your .htaccess file should look like this:

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]

I'm assuming you're using Multisite in Subfolder mode, since in your question your URL is of the form example.com/site/wp-admin. (Edit: Also I just noticed that it's definitely Subfolder per your posted wp-config.php file.)

See the Codex page on .htaccess for details.

1
  • Thanks a lot! It fixed two problems: 1 - Admin area was'nt working (working now) 2 - Images using get_template_directory_uri() at the secondary website with problem (fixed now)
    – Tiago
    Mar 22, 2021 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.