创建多站点并在网站中使用子域名,而不是在目录中。
然后在多站点仪表板>>网站>>设置中定义siteURL。
。htaccess如下所示:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
# avoid error: Request exceeded the limit of 10 internal redirects
RewriteCond %{ENV:REDIRECT_STATUS} 200 [OR]
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
for config.php file
define(\'ENABLE_CACHE\', true);
define(\'CACHE_EXPIRATION_TIME\', 604800);
define(\'WP_MEMORY_LIMIT\', \'92M\');
define(\'MULTISITE\', true);
define(\'SUBDOMAIN_INSTALL\', true);
define(\'DOMAIN_CURRENT_SITE\', \'dev1.domainurl.com\');
define(\'PATH_CURRENT_SITE\', \'/\');
define(\'SITE_ID_CURRENT_SITE\', 1);
define(\'BLOG_ID_CURRENT_SITE\', 1);
define(\'SUNRISE\', \'on\');
要启用customizer,这将有助于:
https://wordpress.org/support/topic/making-customizer-work-with-domain-mapping/