You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress多站点siteurl与home url不一致的文章预览问题求助

Hey there, let's tackle this WordPress multisite preview issue step by step. Based on your setup details, here are the most common fixes to get your post previews working correctly:

Key Troubleshooting Steps for Subfolder Multisite Preview Issues

1. Verify Site URL Configuration

First, double-check the core URL settings for each sub-site:

  • Go to multi.petersons.com/wp-admin/network/sites.php, edit the problematic site.
  • Ensure Site Address (URL) is set to www.petersons.com/sitename (this controls the front-end URL visitors see).
  • Ensure WordPress Address (URL) is set to multi.petersons.com/sitename (this points to where the WordPress core files live for that site).
    Mismatched URLs are the #1 cause of preview failures in split-domain multisite setups.

2. Fix .htaccess Rules

Since you're using a split domain (backend on multi.petersons.com, frontend on www.petersons.com), your .htaccess files need special configuration:

For www.petersons.com root .htaccess:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# Add trailing slash to wp-admin if needed
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

# Skip existing files/directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Route WordPress core requests to the backend domain
RewriteRule ^(wp-(content|admin|includes).*) multi.petersons.com/$1 [L]
RewriteRule ^(.*\.php)$ multi.petersons.com/$1 [L]

# Catch-all for pretty permalinks
RewriteRule . index.php [L]

For multi.petersons.com root .htaccess:

Use the standard subfolder multisite rules:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# Add 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 ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

3. Adjust wp-config.php Constants

Make sure your multisite-related constants are set correctly:

define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false); // Critical for subfolder mode
define('DOMAIN_CURRENT_SITE', 'multi.petersons.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

// Split domain setup constants
define('WP_SITEURL', 'multi.petersons.com');
define('WP_HOME', 'www.petersons.com');

// Force preview links to use front-end URL
define('PREVIEW_POST_LINK', '%site_url%/%postname%');
  • For each sub-site, go to multi.petersons.com/sitename/wp-admin/options-permalink.php and click Save Changes (no need to edit settings—this resets the permalink rewrite rules).
  • Clear all caches: browser cache, WordPress caching plugins (if active), and server-side/CDN caches. Stale cache often breaks preview routing.

5. Check for Plugin/Theme Conflicts

  • Temporarily disable all third-party plugins and switch to a default WordPress theme (like Twenty Twenty-Four).
  • Test the preview function again. If it works, re-enable plugins/themes one by one to identify the conflicting component.

If these steps don't resolve the issue, feel free to share specific details about what happens when you try to preview—like a 404 error, incorrect URL redirect, white screen, or permission message. That will help narrow things down further.

内容的提问来源于stack exchange,提问作者Adam Robertson

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:11:38