Reputation: 205
I have my wordpress site on my local server at the following path :
wordpress-4.2.3\wordpress\wp-content\themes\mytheme
and the url to access my local site is:
http://localhost/wordpress-4.2.3/wordpress/
Now I need to migrate it to another local server, for this I have imported database successfully and copied wordpress
folder and placed it in my project's folder as below:
my-project-name\wp-content\themes\mytheme
and also changed WordPress Address (URL)
and Site Address (URL)
which is initially http://localhost/wordpress-4.2.3/wordpress/
to http://local-server-ip/my-project-name/
but it is not working. Any suggestions?
Upvotes: 0
Views: 71
Reputation: 357
Copy all data to folder "my-project-name"
Open your database > click on SQL tab > Run these commands manually
---------------------------------------------------------------------------
WP Update Query in database
---------------------------------------------------------------------------
UPDATE wp_options SET option_value = replace(option_value, 'http://localhost/wordpress-4.2.3/wordpress', 'http://local-server-ip/my-project-name') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, 'http://localhost/wordpress-4.2.3/wordpress', 'http://local-server-ip/my-project-name');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://localhost/wordpress-4.2.3/wordpress', 'http://local-server-ip/my-project-name');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'src="http://localhost/wordpress-4.2.3/wordpress','src="http://local-server-ip/my-project-name');
then login to your wordpress admin panel go to Setting > Permalinks > click on Save Changes button.
Note: if you have changed your database don't forget to change credintials in wp-config.php
Upvotes: 0
Reputation: 1058
You need to replace all URLs in the database, it is not sufficient to change the values only in the options table (otherwise links and images are corrupted).
Manual Migration:
Migration with Plugin: Download a migration plugin, such as "Wordpress Duplicator"
Upvotes: 1