找不到WordPress多站点文件问题

时间:2019-02-06 04:59:38

标签: wordpress .htaccess config multisite

关于WordPress多站点的问题,因为我的主站点是http://example.com,其他站点是http://example.com/subsite

问题:

1)当我单击名为test的菜单项之一时,它从http://example.com/subsite中显示file not found

2)当我登录并单击名为test的菜单项时,它会完美打开该页面,但是当我编辑该页面以进入该页面上的管理面板时,它会显示file not found

注意(test页受密码保护)

3)我从管理面板访问http://example.com/subsite子站点,然后显示该站点的管理面板,但它很奇怪,并且没有加载CSS并无法正确加载。

我的 config.php 文件如下

<?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');

我的 .htaccess 文件

# 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

到目前为止我一直尝试的解决方案。

https://wordpress.stackexchange.com/questions/246852/wp-admin-not-working-properly-at-wordpress-multisite-with-subdirectories

https://wordpress.stackexchange.com/questions/246852/wp-admin-not-working-properly-at-wordpress-multisite-with-subdirectories/246926

任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:2)

可能您(或某人)对数据库值进行了手动更改。所有这些问题可能来自一个问题-您的网站地址在DB中混乱了。

要解决此问题,最简单的尝试可能是转到Settings > General并重新保存站点链接。如果这样做没有帮助,则需要输入PhpMyAdmin,检查表wp_blogswp_sites中的值,左侧应分别包含域名,而右侧应分别包含路径。

此后,转到每个子站点/站点,然后单击Permalink->SAVE PERMALINKS,看看它们是否可以工作。

答案 1 :(得分:0)

就我而言,发生错误是因为 nginx 充当反向代理服务器。在 Plesk 下,它可以在 Tools & Settings > Services Management 中停用。