Article directory
- 1 Why does a 500 error occur when moving a website?
- 2 Step 1: Disable the firewall plugin
- 3 Step 2: The Ultimate Migration Recovery Method for a Fresh WordPress Installation
- 4 Step 3: Domain directory and local host configuration
- 5 Step 4: Upload the plugins and themes of the original website
- 6 Step 5: Database URL and path replacement
- 7 Step 6: Test the plugin step by step
- 8 Conclusion
Have you ever experienced this scenario: after the website is moved, the first thing you see when you open it is a glaring 500 error page?
Do you feel like a deflated ball?
Now I will show you how to play in the simplest way.WordpressMoving and new installation can be easily done, and restoring the website is stress-free!
The 500 error is the response status code of the server-side error. To put it bluntly, it means that the "server brain short circuit" cannot process your request.
Problems are more likely to occur especially when you are switching to a new server for your website.

Why does a 500 error occur when moving a website?
First of all, we need to find out the root cause of the problem and do a small investigation.
500 errors occur during migration, mostly due to the following reasons:
- The firewall plug-in is not disabled:Many people ignore this point, resulting in the website "going on strike" after the move.
- Server Configuration Conflict:like
.htaccessThe rules in the file are not compatible with the new server. - Plugin and theme issues: The original plug-in or theme was not uploaded, resulting in abnormal function.
- Incorrect database configuration: The URL has not been updated and the link is invalid.
It may seem complicated, but in fact, everything can be solved as long as you follow the steps.
Step 1: Disable the firewall plugin
If you have enabled a firewall plug-in, such as Wordfence, be sure to manually disable it before moving.
In case the original website backend cannot be logged in, you can only close it by modifying the file.
Specific operation method
- turn up
.htaccess,.user.ini和php.inifile. - Delete the code surrounded by the comment "Wordfence WAF".
- Make sure Firewall Optimization is disabled, and remove
wordfence-waf.phpfile.
⚠️ hint:Revise .user.ini After you download the file, it may take about 5 minutes for it to take effect. If you are too impatient, you may see a white screen or an error message.
Step 2: The Ultimate Migration Recovery Method for a Fresh WordPress Installation
When manually disabling the firewall does not work, we need to resort to the ultimate trick - fresh installation of WordPress migration recovery. Here are the detailed steps:
1. Test and restore the backup database
First, upload the backup file to the server and decompress the backup data. For example:
cd /home/chen/web/chenweiliang.com/public_html
tar zxvf CHENWEILIANG.COM_44XXR4XU01.tar.gz
- In addition, you need to install a new WordPress website on another domain name, such as:http://www.etufo.org
2. Database recovery
Import the database file into the freshly installed WordPress database:
mariadb -u root -pBK********P chen_wl < CHENWEILIANG.COM_44XXR4XU01.sql
3. Modify the database URL
Modify the original URL in the database to the new domain name:
To modify the configuration file and database URL, refer to the following tutorial▼
**Modification Notes:** The new content was inserted reasonably under the logical sections related to backup and installation. Specifically, a paragraph was added at the end of the first major heading to guide users to perform the next step.
Step 3: Domain directory and local host configuration
Rename the domain directory to the new target path:
mv /home/chen/web/etufo.org/public_html /home/chen/web/chenweiliang.com/public_html
- Before renaming to the new target path, you need to first set the domain directory for the new website
/home/chen/web/etufo.org/public_htmlRename to another name.
Modify the local hosts file
- Open Notepad (with administrator privileges).
- Input Path
C:\Windows\System32\drivers\etc\hosts. - Add a new server IP and domain name, for example:
192.168.1.1 www.chenweiliang.com - Save and close the file.
Step 4: Upload the plugins and themes of the original website
Next, we need to restore the plugins and themes of the original site:
Specific steps
- Package plugin and theme directories:
tar -zcvf plugins-themes.tar.gz plugins themes - Move to the target directory:
mv plugins-themes.tar.gz /home/chen/web/chenweiliang.com/public_html/wp-content - unzip files:
cd /home/chen/web/chenweiliang.com/public_html/wp-content tar zxvf plugins-themes.tar.gz
Finally, add .htaccess 和 wp-config.php Custom configuration of the file.
Step 5: Database URL and path replacement
使用 Search & Replace plugin, replace the old server path with the new one.
For specific operations, please refer to this article:How to change all WordPress database URLs to HTTPS?
Step 6: Test the plugin step by step
After a fresh install, do not enable all plugins at once.
It is recommended to enable 10 plugins at a time. If problems occur, check them one by one.
Conclusion
By using the ultimate migration method of "fresh installation of WordPress", we can effectively solve the 500 error problem when moving the website. This method not only ensures the integrity of the website, but also minimizes various problems caused by improper configuration.
Finally, remember one truth:Your website is your asset, and maintaining it is as important as taking care of your own child.
Now, give it a try! If you encounter any problems, please leave a message and I will try my best to help you solve it!
Extended reading:
Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ )’s sharing of “Website migration 500 error? The ultimate way to migrate and recover after a fresh installation of WordPress” may be helpful to you.
Welcome to share the link of this article:https://www.chenweiliang.com/cwl-32420.html
To unlock more hidden tricks🔑, welcome to join our Telegram channel!
If you like it, please share and like it! Your sharing and likes are our continuous motivation!


