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

修改本地WordPress站点URL后无法登录,请求技术协助

Fixing WordPress Login & Redirect Issues After MAMP → Bluehost Migration

Hey Josh, let’s work through this migration headache step by step—this is a super common problem when moving from a local MAMP setup to a live Bluehost server, so I’ve got you covered.

First: Fix Your Local Site’s Redirect & Login Problem

The root issue here is that when you updated the WordPress/Site URLs to your Bluehost domain, your local database and config files started pointing to the live server. That’s why you can’t log in locally (cookie domain mismatch) and get redirect errors when trying to edit config files. Here’s how to roll back the local URLs:

Method 1: Edit the Database via phpMyAdmin (Most Reliable)

Since you’re using MAMP, phpMyAdmin is already available to tweak your local database:

  • Launch MAMP, start Apache and MySQL, then click "Open WebStart page". Find and open the phpMyAdmin link.
  • Locate your WordPress database (check your local wp-config.php file’s DB_NAME value if you can’t remember the name).
  • Click into the database, then find the wp_options table (adjust the prefix if you changed it from wp_ during setup).
  • Look for two rows: one with option_name set to siteurl, another to home. Edit both of their option_value fields to your local URL—e.g., http://localhost/your-site-directory or your custom MAMP local domain like http://local.yoursite.com.
  • Save the changes, close phpMyAdmin, and refresh your local site. You should now be able to access and log in without issues.

Method 2: Force Local URLs via wp-config.php

If you’d rather skip the database edit, you can hardcode your local URLs into wp-config.php to override the database settings:

  • Open your local WordPress root folder’s wp-config.php file in a text editor.
  • Add these two lines right before the /* That's all, stop editing! Happy publishing. */ comment:
define('WP_HOME','http://localhost/your-site-directory');
define('WP_SITEURL','http://localhost/your-site-directory');
  • Replace the URL with your actual local site address, save the file, and refresh your local site. The redirect should stop, and you’ll be able to log in again.

Next: Do the Migration the Right Way (Avoid Future Issues)

Now that your local site is working again, let’s get it moved to Bluehost properly:

  1. Backup Local Files: Zip up all files in your MAMP WordPress site folder.
  2. Backup Local Database: Use phpMyAdmin to export your local database as a SQL file.
  3. Upload Files to Bluehost: Use Bluehost’s cPanel File Manager or an FTP tool to upload your zipped site files to the public_html folder (your server’s web root), then unzip them.
  4. Set Up Bluehost Database: In Bluehost’s cPanel, create a new database, a database user, and assign full permissions to that user for the new database.
  5. Import Database to Bluehost: Use Bluehost’s phpMyAdmin to import your local SQL file. Then, just like you did locally, edit the wp_options table’s siteurl and home values to your live Bluehost domain (e.g., https://yoursite.com).
  6. Update wp-config.php for Bluehost: Edit your local wp-config.php to use the new Bluehost database credentials (DB_NAME, DB_USER, DB_PASSWORD, DB_HOST—Bluehost usually uses localhost for the host). Upload this updated file to Bluehost to replace the existing one.
  7. Fix Hardcoded Local URLs: Many themes, plugins, and posts store local URLs in the database. Run these SQL queries in Bluehost’s phpMyAdmin to replace all instances of your local URL with your live domain (adjust the table prefix and URLs as needed):
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://localhost/your-site-directory', 'https://yoursite.com');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http://localhost/your-site-directory', 'https://yoursite.com');
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://localhost/your-site-directory', 'https://yoursite.com');

If You’re Having Login Issues on the Live Bluehost Site

If after migration you can’t log into the live site, it’s likely a cookie domain mismatch. Add these lines to your Bluehost wp-config.php file:

define('COOKIE_DOMAIN', 'yoursite.com');
define('COOKIEPATH', '/');
define('SITECOOKIEPATH', '/');

Replace yoursite.com with your actual domain, clear your browser’s cache and cookies, then try logging in again.

内容的提问来源于stack exchange,提问作者Josh L.

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 07:40:45