0

This may be the most redundant/dumbest question known to man, but if I go into Wordpress' General Settings and modify my Site Url to include a www, so

http://mysite.com

becomes

http://www.mysite.com

do I need to run a MySQL query to find/replace my image sources, my interior page links, etc? They all currently point to an address without the www, will this cause an issue?

1 Answer 1

1

This code could help you, just change mysite.com and www.mysite.com and go to phpMyadmin run that Sql code:

UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 'mysite.com', 'www.mysite.com');
UPDATE wp_options SET option_value = REPLACE(option_value, 'mysite.com', 'www.mysite.com');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'mysite.com', 'www.mysite.com');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'mysite.com', 'www.mysite.com');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, 'mysite.com', 'www.mysite.com');
UPDATE wp_posts SET guid = REPLACE(guid, 'mysite.com', 'www.mysite.com');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, 'mysite.com', 'www.mysite.com');
UPDATE wp_users SET user_email = REPLACE(user_email, 'mysite.com', 'www.mysite.com');
UPDATE wp_users SET user_url = REPLACE(user_url, 'mysite.com', 'www.mysite.com');

OR

You can use that simple tool it will generate it for you. If you are using different Table Prefix just change wp_ with your table prefix.

4
  • Please explain your code in human terms and explain why you think it should solve the problem.
    – s_ha_dum
    Commented Feb 12, 2014 at 23:14
  • @RCNeil want mysite.com to www.mysite.com? This code just will replace it. Commented Feb 12, 2014 at 23:23
  • Do you know if this covers ALL fields that use the site url setting? I agree that you should elaborate a bit on your answer, although it was helpful. Is it necessary? Is it everything? Thank you.
    – RCNeil
    Commented Feb 13, 2014 at 5:38
  • It will help you. Go to your phpMyadmin panel and run this sql code. it will change your old url(mysite.com) to new url(www.mysite.com). And I updated my answer check out. I hope, that help you. @RCNeil Commented Feb 13, 2014 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.