At times, WordPress will automatically redirect you to a different website when you try to login to your admin panel. This is both frustrating and worrying. If you’re wondering if your site is hacked, then it’s not that serious. You can easily solve this problem within a few steps. In this article, we explain three steps in which to fix the redirection error.
1. Make Changes to .htaccess File
The first thing you need to be doing is making changes to your .htaccess file. This is the distributed configuration files that decides, to a large extent, how your WordPress website will function.
Before moving ahead with the process, it’s important to take a backup of the file. So that when there are any additional error, you can restore back your website.
Here are the steps to follow:
2. Update the Config File
The other thing you can do is edit the Config file in your WordPress. This is present in every WordPress website by the name of “wp-config.php”.
To make the necessary changes, here are the steps involved:
1. Make Changes to .htaccess File
The first thing you need to be doing is making changes to your .htaccess file. This is the distributed configuration files that decides, to a large extent, how your WordPress website will function.
Before moving ahead with the process, it’s important to take a backup of the file. So that when there are any additional error, you can restore back your website.
Here are the steps to follow:
- Login to the cPanel using admin credentials.
- Go into File Manager.
- Double-click on the public_html directory to open it.
- Open the .htaccess file by right-clicking on it and selecting edit.
- If you find any code for redirection, remove it and save the file. You can do this by searching for “redirect”.
2. Update the Config File
The other thing you can do is edit the Config file in your WordPress. This is present in every WordPress website by the name of “wp-config.php”.
To make the necessary changes, here are the steps involved:
- Login to your cPanel account using admin credentials.
- Go to File Manager.
- Navigate into the public_html directory and open the wp-config file for editing. Find the following lines:
Code:
define( 'WP_SITEURL', 'https://www.example.com');
define( 'WP_HOME', 'https://www.example.com');
- Replace them with the URL of your website, the URL you want to land on after logging in.