0

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

enter image description here

enter image description here

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 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 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 Commented Oct 10 at 17:17
  • @TomjNowell. Screenshots attached I mean example.com/subsite Commented Oct 10 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 at 18:20

1 Answer 1

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

1
  • Okay, that makes sense. It was pulled to test. But that didn't get it fixed. Commented Oct 10 at 19:28

Your Answer

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

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