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

WordPress站点链接失效且无法登录后台求助

Hey there, let's work through this WordPress issue together—this is a super common headache when launching or updating site URLs, so we'll get it sorted out.

First: Regain Access to wp-admin

The main hurdle right now is getting back into your admin dashboard. Here are two reliable ways to fix the URL mismatch:

  1. Edit wp-config.php (Quickest Method)
    Connect to your server via FTP or cPanel File Manager, find the wp-config.php file in your site's root folder, and add these two lines right above the /* That's all, stop editing! Happy publishing. */ comment:

    define('WP_HOME', 'http://projekts.dk');
    define('WP_SITEURL', 'http://projekts.dk');
    

    This forces WordPress to use your new URL for both the front-end site and the admin area, bypassing the database settings temporarily. Save the file, then try accessing http://projekts.dk/wp-admin again—you should be able to log in now.

  2. Update the Database Directly
    If you can't edit wp-config.php, use phpMyAdmin (via your hosting control panel):

    • Find your WordPress database, then locate the wp_options table (your table prefix might be different if you changed it during setup).
    • Look for rows where option_name is siteurl and home, then update their option_value to http://projekts.dk.
    • Save the changes, then try logging into wp-admin.

You mentioned trying a MySQL search-replace but it didn't work—this is usually because WordPress stores some data as serialized arrays, and plain text replacement breaks that formatting. Here are safe ways to fix this:

  1. Use WP CLI (Most Reliable for Developers)
    If your hosting supports WP CLI, run this command in your site's root directory (replace old-url with your previous site URL, e.g., http://localhost/your-site or the old domain):

    wp search-replace 'old-url' 'http://projekts.dk' --all-tables
    

    This command automatically handles serialized data, so it won't break any settings or content.

  2. Use a WordPress Plugin (User-Friendly)
    Once you're logged into wp-admin:

    • Install and activate the Better Search Replace plugin.
    • In the plugin settings, enter your old URL in the "Search for" field, and http://projekts.dk in the "Replace with" field.
    • Check all tables in the "Select tables" section.
    • First, check "Run as dry run" to preview changes (make sure nothing looks off), then uncheck it and run the replacement.

Final Step: Clean Up & Verify

  • After replacing links, go to Settings > General in wp-admin and confirm that both "WordPress Address (URL)" and "Site Address (URL)" are set to http://projekts.dk. Save the settings—this will update the database properly, and you can remove the lines you added to wp-config.php if you want.
  • Clear your browser cache, and any server-side cache (like CDN, Redis, or caching plugins) to make sure the new links load correctly.
  • Test a few pages (like your Kontakt page) to confirm links are working now.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.22 08:46:50