Today I am working on one of my client projects. The site is very simple and it was built by WordPress. No extreme plugins are on the site. What I did, was I just migrated the database using the WP Migrate DB plugin and transfer all WP files to my computer via Filezilla. Then I edit the database login in “wp-config.php” so my migrated site can connect to my database. After that, visit the migrated URL. Everything is working perfectly on the front end. Next, I go to the login URL (yourdomain.com/wp-login/) and enter the WP login. I expect to see the WP dashboard page but wait, the site is redirected to the home page. No matter what I try, it ends up the same. WHY?
Issue: After login, the page always redirects to the home page
As I mentioned above, after migration, I am trying to log in but the page always redirects to the home page.
Next, I try to add ‘/wp-admin/’ after yourdomain.com. I do this after I log in. If I log in successfully, I should see the WP dashboard. But I get the error message that says Sorry, you are not allowed to access this page. ???
Cause
Hmm, after migration, I can view the site but I can not access the WP dashboard. After that, I checked the wp-config.php file and I noticed the table prefix setting is not the same as the production site. Aha!
Here how the table prefix looks like:
Production site => $table_prefix = ‘586xDJU‘;
My localhost => $table_prefix = ‘586xdju‘;
Do you see just like I see?
Reason and Solution
The production site is Linux and Linux is case-sensitive. The production site creates the table prefix by mixing between lowercase and uppercase. While my computer is Windows and it is not case-sensitive. It turns all table names into lowercase. This is the issue that causes the access denied to the WP dashboard in my case.
Issue: Migrate from HTTPS to HTTP from SiteGround hosting
SiteGround is the best and easiest to set up WordPress sites for beginners and non-tech people. It offers 24-hour support with real humans and gives you performance WordPress hosting within your budget. Also, it comes with a SiteGround plugin which creates the cache system(server level) and other features you may need for your WordPress site. I strongly recommend SiteGround to everyone.
Cause
Okay, I migrated one of my client sites that hosts the site on SiteGround. With the SiteGround plugin, you can set redirect to HTTPS. So if you install an SSL certificate on your site and you want “HTTP” links to redirect to “HTTPS” links, you need to set the redirect feature.
Solution
Once you migrate the site with HTTPS to your localhost which is HTTP, you must disable the SiteGround plugin by renaming the plugin name so it will be disabled but the plugin is still in your localhost. This way, after migration, your site won’t redirect to HTTPS on your localhost. On the login form, you may notice a JS error and show the HTTPS link. If you see the error, try my solution.
In other plugins, you may set the redirect, and the data is saved to the database. To fix the redirect issue, you should rename those plugin names. It should solve your redirect issue on your locahost.