admin管理员组

文章数量:1122832

Recently setup WordPress multisite with several sub domains. Domain/Sub-Domain The installation worked and the sub-sites are active but I can not access the Admin panel or any other page/links. Returns 404

Things I've tried.

  • Checked the WP-Config File
define( 'WP_DEBUG_LOG', true );
define('WP_ALLOW_MULTISITE', true);
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
define( 'DOMAIN_CURRENT_SITE', 'domain.domain' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
define( 'WP_POST_REVISIONS', 35);
define( 'WP_MEMORY_LIMIT', '3048M' );
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
define( 'SCRIPT_DEBUG', false );
define( 'WP_DEBUG_LOG', false );
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', __DIR__ . '/' );

Checked the htaccess file

#Subfolder Example

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]

#SubDomain Example

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).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]


# BEGIN WordPress Multisite
<IfModule mod_rewrite.c>
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).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress Multisite

The main domain is active and functioning fine but all the Admin panels and pages of the subsites are giving 404

Recently setup WordPress multisite with several sub domains. Domain.com/Sub-Domain The installation worked and the sub-sites are active but I can not access the Admin panel or any other page/links. Returns 404

Things I've tried.

  • Checked the WP-Config File
define( 'WP_DEBUG_LOG', true );
define('WP_ALLOW_MULTISITE', true);
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
define( 'DOMAIN_CURRENT_SITE', 'domain.domain.org' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
define( 'WP_POST_REVISIONS', 35);
define( 'WP_MEMORY_LIMIT', '3048M' );
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
define( 'SCRIPT_DEBUG', false );
define( 'WP_DEBUG_LOG', false );
if ( ! defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', __DIR__ . '/' );

Checked the htaccess file

#Subfolder Example

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]

#SubDomain Example

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).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]


# BEGIN WordPress Multisite
<IfModule mod_rewrite.c>
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).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress Multisite

The main domain is active and functioning fine but all the Admin panels and pages of the subsites are giving 404

Share Improve this question edited Oct 10, 2024 at 17:19 Jeremy Thomas asked Oct 10, 2024 at 15:26 Jeremy ThomasJeremy Thomas 32 bronze badges 5
  • what kind of 404 are you seeing? Nginx 404? Apache? WordPress styled 404? Something else? When you say subsite do you mean example.com/subsite or subsite.example.com? Is it just WP Admin affected? Edit your question to add as much info as you can, bonus points for screenshots – Tom J Nowell Commented Oct 10, 2024 at 16:10
  • Your .htaccess file includes both the subdirectory and the subdomain rules. Since you're using subdomains (define( 'SUBDOMAIN_INSTALL', true );), you should remove the subdirectory rules. – Pat J Commented Oct 10, 2024 at 16:40
  • Remove this from htaccess? # BEGIN WordPress Multisite <IfModule mod_rewrite.c> 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).*) $1 [L] RewriteRule ^(.*\.php)$ $1 [L] RewriteRule . index.php [L] </IfModule> # END WordPress Multisite – Jeremy Thomas Commented Oct 10, 2024 at 17:17
  • @TomjNowell. Screenshots attached I mean example.com/subsite – Jeremy Thomas Commented Oct 10, 2024 at 17:20
  • @JeremyThomas -- here are the recommended WordPress .htaccess files; use only the one for your particular situation (I'm assuming you're looking for Subdomain with WordPress >= 3.5). developer.wordpress.org/advanced-administration/server/… – Pat J Commented Oct 10, 2024 at 18:20
Add a comment  | 

1 Answer 1

Reset to default 0

To clarify my comments (since comments don't lend themselves to code blocks), you should only be using the .htaccess rules that apply to your particular WordPress installation. I'm assuming in this answer that you're using WordPress greater than 3.5 (the current release as I write this is 6.7), and your question shows Subdomain Multisite. Thus, your .htaccess file should contain:

# BEGIN WordPress Multisite
# Using subdomain network type: https://wordpress.org/documentation/article/htaccess/#multisite

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
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).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

# END WordPress Multisite

If you need other, non-WordPress rule (eg you're hosting static HTML files on the same server), any rules you set for those should be unchanged.

Reference: HTTPD / .htaccess for WordPress

本文标签: WordPress Multisite Sub Domains Admin Panels 404 Error