Link to home
Start Free TrialLog in
Avatar of Lev Seltzer
Lev SeltzerFlag for Israel

asked on

Need SQL statement for WordPress to fix WWW problem

My client started their WordPress website with a domain and hard-coded it to not have a "www." in front of the domain. Unfortunately, this caused problems on the local "windows domain" network in the office. The LAN technician said that the website had to be changed to include "www." we did, and now we need to adjust all the references to images and pages in the website that currently do not have a "www.".

Therefore, I am looking for one or more SQL statements that I can execute in MyPHPAdmin to change all references of "http://domain.com" to "http://www.mydomain.com". This would be in at least these two fields of the wp_posts table:
post_content
GUID
There might be other fields in this table and there might be other tables to modify, too. I am not sure.

I am not an expert on MySQL, so I am not sure how to formulate the SQL statements. I am also not expert enough in WordPRess to know if there are other fields and tables to search through or not.

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of mankowitz
mankowitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lev Seltzer

ASKER

I managed to replace the domain name in the wp_posts, wp-postmeta and wp_options files. Thank you both for your quick and accurate replies.