WordPress Multisite Subdomains on Apache not Working
-
I am converting my WordPress multisite from a subfolder to the subdomain, trying to add a new site in a subdomain.mysite.com. I have configured A Record on Cloudflare and configured a virtual host on Apache. I can access my subdomain.mysite.com successfully and I can see the index.html page.
Directory permission set to 755 and www-data:www-data is the owner of the directory
Added the following in wp-config.php
define( 'WP_ALLOW_MULTISITE', true ); define( 'MULTISITE', true ); define( 'SUBDOMAIN_INSTALL', true ); define( 'DOMAIN_CURRENT_SITE', 'mysite.com' ); define( 'PATH_CURRENT_SITE', '/' ); define( 'SITE_ID_CURRENT_SITE', 1 ); define( 'BLOG_ID_CURRENT_SITE', 1 );
Added the following in .htaccess because WordPress on Network Settings suggested adding it.
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]
When I try to add a new site on WordPress, I am getting different errors
Warning: require_once(/var/www/mysite-com/public_html/wp-content/themes/twentytwentyone/inc/classes/class-mobile-detect.php): failed to open stream: No such file or directory in /var/www/mysite-com/public_html/wp-content/themes/bombom/inc/structure/mobile.php on line 5
Fatal error: require_once(): Failed opening required ‘/var/www/mysite-com/public_html/wp-content/themes/twentytwentyone/inc/classes/class-mobile-detect.php’ (include_path=’.:/usr/share/php’) in /var/www/mysite-com/public_html/wp-content/themes/bombom/inc/structure/mobile.php on line 5
There has been a critical error on this website.
After adding the new site in the subdomain I get an error “There has been a critical error on this website.” but after refreshing the page I can see subdomain.mysite.com under the Sites section but once I click on the Subdomain’s Dashboard (https://subdomain.mysite.com/wp-admin/) I get error 404. The subdomain directory is also empty on Unix Server.
Can anyone please guide me where is the problem? Why does WordPress fail to install required files in the subdomain?
- The topic ‘WordPress Multisite Subdomains on Apache not Working’ is closed to new replies.