修改WordPress地址(URL)后博客无法显示求助
Let’s walk through the most common fixes for your problem where only the static home page loads after updating your WordPress and Site URLs to /home and setting "Blogs" as your posts page:
1. Flush Rewrite Rules (Fixes Permalink Routing)
This is the first thing to check because updating your site URLs often breaks WordPress’s rewrite rules, which handle routing to pages and posts.
- If you can still access your WordPress admin:
- Go to Settings → Permalinks
- Select any permalink structure different from your current one (e.g., switch from "Post name" to "Day and name"), save changes
- Switch back to your preferred structure and save again
- If you can’t access the admin, use WP-CLI (if available on your staging server):
- Run this command via SSH:
wp rewrite flush
- Run this command via SSH:
- Alternatively, manually update your
.htaccessfile (in your WordPress root directory) with the default WordPress rewrite rules:
Make sure# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /home/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /home/index.php [L] </IfModule> # END WordPressRewriteBasematches your new site URL path (/home/)
2. Verify WordPress vs. Site URL Alignment
Double-check that your URL settings match where your WordPress files are actually stored:
- If your WordPress core files are still in the original
/resourcesdirectory, you should only update the Site URL to/home, leaving the WordPress URL as/resources. The WordPress URL points to where your wp-config.php, wp-content, etc., live, while the Site URL is what visitors see. - If you moved the WordPress files to
/home, confirm file permissions are correct (directories should be755, files644) so the server can access them.
3. Validate Your "Blogs" Posts Page Setup
Ensure the page you selected as your posts page is properly configured:
- Go to Pages → All Pages and confirm the "Blogs" page exists and isn’t set to draft or private status.
- Check if the page’s slug (the part after
/home/in its URL) conflicts with any custom post types, categories, or plugins. For example, a category named "blogs" could cause a 404 conflict.
4. Check Staging Server Configuration
Staging environments sometimes have restricted settings—confirm your web server is set up to handle the new URL:
- For Apache: Ensure the
mod_rewritemodule is enabled, and your virtual host allows overrides (setAllowOverride Allfor your site directory). - For Nginx: Make sure your server block includes rewrite rules to route all requests to
index.php:location /home { try_files $uri $uri/ /home/index.php?$args; } - Reach out to your hosting provider or dev ops team if you’re unsure about server-level settings.
5. Clear All Caches
Staging environments often hold onto old URL data via caching:
- Clear your browser cache and test the site in incognito mode.
- If using a WordPress caching plugin (like WP Rocket or W3 Total Cache), clear its cache from the admin (if accessible) or delete cache files via FTP/SSH.
- Flush any server-side object caching (e.g., Redis, Memcached) if enabled.
If none of these steps work, try temporarily disabling all plugins to rule out conflicts, or switch to a default theme (like Twenty Twenty-Four) to see if a custom theme is causing the issue.
内容的提问来源于stack exchange,提问作者Abhi

