How to resolve 500 Internal Server Error on WordPress after migration?


Migrated a WordPress site from local development computer to a production server and encountering 500 Internal Server Errors when visiting posts or pages like the error message below:
The server encountered an internal error or misconfiguration and was unable to complete your request.
In this post we shall see How to resolve 500 Internal Server Error on WordPress after migration?

The basic steps involved in migrating WordPress website from local server to live sever are given below:
  1. Upload the entire WordPress website installation folder from the local server to live server under htdocs or httpddocs or www or public_html folder. 
    • You can upload the files or zipped folder to the live server via FTP or by using the web host file manager interface to upload the files.
  2. Open phpMyAdmin on local server and export the database used by the WordPress website
  3. Clean up the URL
    • On the local server, the URL of the website would be something like http://localhost or http://localhost:8080 (if using a different http port).
    • Open the exported mysql file in a notepad or better with notepad++ and replace all instances of http://localhost with
  4. Open phpMyAdmin on the live server and create a database. 
  5. Import the database exported on the local server to the live server using phpMyAdmin on the live server
  6. Check wp_options table in the live server using phpMyAdmin if the Site URL and Home are update to the live domain URL. If not update.
  7. Open file manage one the web host or using FTP. 
    • Find wp-config.php and update the database name, username, and other settings if necessary as per your host details
  8. Open your website and check.
 The above steps are basic. You may check out elaborate steps online.

How to resolve 500 Internal Server Error on WordPress after migration?

There may be several reasons why we see 500 Internal Server Error but the most common cause with WordPress website seeing 500 error is due to .htaccess file.

  • Open root directory where WordPress is installed using FileZilla or from any preferred FTP client or from the online File Manager web interface provided by the web host. 
  • The root directory is generally by the name public_html or htdocs or httpddocs or www.
  • If you don’t see your .htaccess file or any files starting with dot (.) , make hidden files view-able by clicking Server and selecting Force Showing Hidden Files (from FTP client). If using web interface, check for similar settings to show hidden files if any.
  • Once .htaccess file is found, right-click it, and rename it “.htaccess.bak” to backup the .htaccess file. This makes the site's .htaccess file become unavailable. We now need to create a new .htaccess file. Don't access your site yet, there will be errors.
  • Login to the WordPress admin and navigate to Settings > Permalinks. Select Permalinks of desired permalink structure if not already. If Permalinks is already selected, let it be. Scroll down to the bottom of the page, and click Save Changes.
  • Open the WordPress website in a browser. Check if the 500 internal server error is gone.
If the 500 Internal Server Error issue is resolved, then it was caused by the .htaccess file due to some incorrect settings which is the most common cause for 500 Internal Server Error. And it is easier resolved by letting WordPress recreate the .htaccess file as per the steps discussed above.

If the 500 Internal Server Error still exists, then it could be due to some other issues which you need to check any Apache and PHP error logs on the server. These logs can provide valuable context related to any code failures or other potential causes of a site failure. Logs can be accessed from the control panel provided by web host.

The following is the default permalink rewrite code which should be included in the .htaccess file (since WordPress 3.0):

# 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]
# END WordPress

More information regarding Permalinks on WordPress here.

Comment with Facebook