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, I just migrate the database using 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 frontend. Next, I go to 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 home page. No matter what I try, it ends up the same. WHY?
How to migrate WordPress site with 3 options
Issue: After login, page always redirect to home page
As I mention above, after migration, I am trying to login but the page always redirects to home page.
Next, I try to add ‘/wp-admin/’ after yourdomain.com. I do this after I log in. If I login successful, I should see the WP dashboard. But I get the error message says Sorry, you are not allowed to access this page.
Hmm, after migration, I can view the site but I can not access the WP dashboard. After that, I check the wp-config.php file and I notice the table prefix setting is not the same as the production site.
Here how it looks like.
Production site => $table_prefix = ‘586xDJU’;
My localhost => $table_prefix = ‘586xdju’;
The Reason and Solution
The production site is Linux and Linux is case-sensitive. The production site creates the table prefix with mixing between lowercase and uppercase. While my computer is Windows and it is not case-sensitive. It turns all table names to lowercase. This is the issue that causes the access denied to WP dashboard in my case.
Issue: Migrate from https to http from SiteGround hosting
SiteGround is the best and easy to setup WordPress site for beginner. It offers 24 hours support with real human and gives you the performance WordPress hosting within your budget. Also, it comes with SiteGround plugin which creates the cache system and other features you may need for your WordPress site.
Okay, I migrate one of my client sites that hosts the site on SiteGround. With SiteGround plugin, you can set redirect to https. So if you install SSL certificate on your site and you want “http” links to redirect to “https” links, you need to set the redirect feature.
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 disable. This way, after migration, your site won’t redirect to https on your localhost. On the login form, you may notice JS error and show the https link. If you see the error, try my solution.
Other plugins, you may set the redirect and the data is saved to database. To fix the redirect issue, you should rename those plugin name. It should solve your redirect issue on your locahost.