WordPress迁移至新主机新域名失败:Apache正常提示原因及修复方法
That "Apache is functioning normally" message means your web server is up and running, but it's not serving your WordPress site—it’s falling back to the default Apache landing page instead. Let’s walk through the most common causes and fixes to get your site live:
1. Default Apache Index File Is Taking Priority
Most hosts add a default index.html or index.php file to the document root when you create a new domain. If this file exists, Apache will serve it before WordPress’s index.php, resulting in the default message.
Fix:
- Connect to your server via FTP, SFTP, or your host’s file manager.
- Navigate to your site’s document root (usually
public_html,www, or a custom subfolder). - Look for files named
index.html,default.html, orwelcome.php. Delete or rename them (e.g.,index.html.old) to remove their priority. - Refresh your site—Apache should now serve WordPress’s
index.phpinstead.
2. Incorrect Document Root Configuration
If you uploaded WordPress files to a subfolder but your host’s document root is pointing to the parent directory, Apache won’t find your site’s core files. For example, if you uploaded WP to public_html/preloved-bazaar but the document root is set to public_html, you’ll see the default page.
Fix:
- Log into your hosting control panel (cPanel, Plesk, etc.).
- Find the domain management section (e.g., "Domains" or "Addon Domains").
- Check the "Document Root" setting for your new domain—it should point directly to the folder containing
wp-config.phpand thewp-contentfolder. - Adjust the setting if needed, save changes, and clear your browser cache before reloading the site.
3. Missing or Misconfigured .htaccess File
WordPress uses the .htaccess file to handle permalinks and route all requests to index.php. If this file is missing, corrupted, or unreadable by Apache, the server won’t know to serve your WordPress site.
Fix:
- If
.htaccessis missing: Create a new file in your document root named.htaccessand paste these default WordPress 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 - If it exists: Verify the rules match the above, and set file permissions to
644(so Apache can read it). - Once you can access the WordPress admin, regenerate the file by going to Settings > Permalinks and clicking "Save Changes".
4. Incorrect File Permissions
Overly restrictive or open file/folder permissions can prevent Apache from reading your WordPress files, leading to the default page.
Fix:
- Using your file manager or SSH, set these permissions:
- All WordPress files:
644(read/write for owner, read-only for others) - All WordPress folders:
755(read/write/execute for owner, read/execute for others) wp-config.php:600(read/write only for owner—extra security)
- All WordPress files:
- Avoid setting permissions to
777—it’s a major security risk.
5. Virtual Host Misconfiguration (Self-Managed VPS/Dedicated Server)
If you’re running your own server (e.g., Ubuntu/Debian with Apache), your virtual host config might point to the wrong directory or lack the correct domain settings.
Fix:
- SSH into your server and navigate to Apache’s sites-available directory (usually
/etc/apache2/sites-available/). - Open your domain’s virtual host file (e.g.,
preloved-bazaar.stilgut.pl.conf). - Verify these lines are correct:
ServerName preloved-bazaar.stilgut.pl DocumentRoot /var/www/preloved-bazaar.stilgut.pl/public_html - Ensure the
DocumentRootpath matches where your WordPress files are stored. - Enable the site if needed:
sudo a2ensite preloved-bazaar.stilgut.pl.conf - Reload Apache to apply changes:
sudo systemctl reload apache2
Final Checks
After trying the above steps:
- Clear your browser cache or test in incognito mode to avoid cached content.
- Double-check that your DNS records for the new domain point to the new host’s IP address (propagation can take up to 24 hours, but is often faster).
内容的提问来源于stack exchange,提问作者BartekMerryChristmas

