This article aims to solve the redirect problem of WordPress.
Step 1. Check the website address
Check the website address in the admin page, make sure it is correct. It is in the Settings/General page.
Step 2. Open the template-loader.php
Open the template-loader.php file. Assume the root dir of the wordpress is “wordpress”.
# If the dir required root permission, add sudo at the beginning. vim /wordpress/wp-includes/template-loader.php
Step 3. Edit the file
Edit the template-loader.php, comment the following codes:
if( defined(‘WP_USE_THEMES’) && WP_USE_THEMES ) do_action(‘template_redirect’);
Step 4. Save the file and refresh
Save the file and refresh your website, it is ok now.