[ad_1]
Hello,
Can anyone list out the things needs to be taken care while migrating wordpress from localhost to live server?
Recently i tried to migrate the wordpress from local machine to server but getting errors related to mix contents. Is there a way to fix it without using plugin?
In other words how to switch the website from http to https or vice-versa.
Your help will be appreciated, thanks.
[ad_2]
That’s a common issue when migrating – and easily fixed! First, ensure that your SSL certificate is setup correctly.
Then, install the Better Search Replace plugin and use it to find/replace the broken URLs eg ‘http://localhost/’ becomes ‘[https://example.com/](https://example.com/). Also fix URLs that only have ‘http’ eg ‘[http://example.com](http://example.com)’ becomes ‘[https://example.com](https://example.com)’
Never perform a find/replace on an sql file, as you’ll corrupt serialised strings.
The problem is the initial setup on local, because you didn’t set SSL.
Probably locally you developed on [http://127.0.0.1/yourwebsite](http://127.0.0.1/yourwebsite) so all links in your database have http instead of https.
Now you have your hosting, installed SSL certificate so all requests go through HTTPS, but still, because you added all the records from the local database to the hosting, your links are http and they need to be https because you have SSL certificate.
As bluesix told you you can do it with plugin or if you can access terminal on your hosting, you can do it with WP CLI by running:
wp search-replace http://yoursite.com https://yoursite.com –all-tables –dry-run
if it’s success, run it again without –dry-run flag, and that’s it 🙂
There is also option with opening SQL dump in text editor tool and changing all links but it’s not always reliable, so I advise using tools for this.
Who is the host? Most provide some kind of plugin or use something like All In One WP Migrate, where you wouldn’t need to do a search and replace.