Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change site URL and WordPress URL in Localhost

Tags:

wordpress

I am work in Wordpress. And my system localhost url is http://localhost:8080/wordpress.
I want to shift our site another system.

My problem is that my another system localhost url is http://localhost/wordpress (not include 8080). So can you help me that is how many table update in our database

like image 689
vikal singh Avatar asked Apr 17 '15 10:04

vikal singh


2 Answers

I use the following queries to update domain name of the site

UPDATE wp_options
SET option_value = 'http://new-domain-name.com'
WHERE option_name = 'home';

UPDATE wp_options
SET option_value = 'http://new-domain-name.com'
WHERE option_name = 'siteurl';

UPDATE wp_posts
SET post_content = REPLACE(post_content,'http://old-domain-name.com','http://new-domain-name.com');

UPDATE wp_posts
SET guid = REPLACE(guid,'http://old-domain-name.com','http://new-domain-name.com');

Just change http://old-domain-name.com and http://new-domain-name.com to appropriate domain names. This should help you.

like image 181
iurii Avatar answered Sep 18 '22 14:09

iurii


Fastest and best way to change the URL is to go to the wp-config.php File and place this code:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
like image 38
Waleed Muaz Avatar answered Sep 20 '22 14:09

Waleed Muaz