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

WordPress wp-admin重定向异常求助:Local by Flywheel测试站点问题

Fixing the Redirect Loop/Invalid URL in Local by Flywheel WordPress Admin

Let's break down why you're seeing that weird duplicated URL redirect and fix it step by step—this is a super common issue when migrating WordPress sites to Local, so you're not alone!

1. Fix the WP_HOME/WP_SITEURL Format in wp-config.php

First, the mistake I spot right away: your wp-config.php definitions are missing the full URL including the protocol (http:// or https://). WordPress needs the complete URL to build redirects correctly, and omitting it causes it to incorrectly append parts of the old URL.

Update those lines to:

define('WP_HOME','http://example.local');
define('WP_SITEURL','http://example.local');

If you have SSL enabled in your Local site settings, swap http:// for https:// instead.

2. Clean Up Old URL References in the Database

Even with the wp-config fix, your database is probably still full of references to the old example.com URL. This is the most common culprit for wonky redirects. Here's how to fix it:

  • Open your Local site, go to the Database tab, and click "Open Adminer" (or use phpMyAdmin if you prefer).
  • Run these SQL queries (replace wp_ with your actual table prefix if it's different, and double-check the old/new URLs):
-- Update core site URLs
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://example.com', 'http://example.local') WHERE option_name = 'home' OR option_name = 'siteurl';

-- Update post content (links, images, etc.)
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://example.com', 'http://example.local');

-- Update custom fields and metadata
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http://example.com', 'http://example.local');

Note: If you have other tables with URL references (like from plugins), you might need to run similar queries for those, but the three above cover 90% of cases.

3. Verify Local Site SSL Settings

If you've enabled SSL in your Local site's settings (under "SSL" in the site dashboard), make sure your WP_HOME/SITEURL and database URLs all use https://. Mismatched protocols (http vs https) will trigger endless redirects.

Sometimes broken permalink rules cause redirect issues. If you can get into wp-admin eventually:

  • Go to Settings > Permalinks
  • Select any different permalink structure, save changes, then switch back to your preferred one and save again.

If you still can't access admin, edit your site's .htaccess file (found in the site's root folder in Local) and replace it with the default WordPress rewrite rules:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

5. Clear All Caches

  • Clear your browser's cache and cookies again (I know you tried this, but do it once more after the above fixes).
  • In Local, go to your site's Tools tab and click "Clear Cache" (both site and server cache).
  • Restart the Local app entirely to make sure no cached settings are stuck.

After going through these steps, try accessing http://example.local/wp-admin again—this should resolve the duplicated URL redirect issue.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 04:26:34