{"id":596,"date":"2012-11-02T18:28:22","date_gmt":"2012-11-03T02:28:22","guid":{"rendered":"http:\/\/www.zenutech.com\/kb\/?p=596"},"modified":"2012-11-02T18:30:11","modified_gmt":"2012-11-03T02:30:11","slug":"my-wordpress-website-is-working-but-the-images-and-styles-are-not-loading","status":"publish","type":"post","link":"https:\/\/www.zenutech.com\/kb\/article\/my-wordpress-website-is-working-but-the-images-and-styles-are-not-loading\/","title":{"rendered":"My WordPress website is working but the images and styles are not loading &#8230;"},"content":{"rendered":"<p>If you have moved your WordPress blog over to Zenutech, have reconfigured <em>wp-config.php<\/em> to use the new database details, imported your data into the new database, then you might just see is text and hyperlinks with no images.  If that is the case, then the problem is likely due to a URL discrepancy between your development URL and the live URL.  This is because all the image links and URLs were from your development environment and now that the site is in a different location so WordPress is not finding the images and styles.<\/p>\n<p>You can view the page source in your browser, use <a href=\"https:\/\/addons.mozilla.org\/en-US\/firefox\/addon\/firebug\/\">FireBug<\/a> in Mozilla FireFox, or view your domain&#8217;s error log on the server to obtain the URL of the files not being found (they will give 404 error).  The URL that the web server is looking for is the OLD URL that you will be replacing so you want to note what it is.<\/p>\n<p>You will need to execute some SQL search and replace statements to resolve this issue.  Log into phpMyAdmin in the control panel using your NEW WordPress MySQL username and MySQL user password (the new username and password that were written in wp-config.php when you reconfigured it), select your WordPress database from the dropdown on the left hand side, and go to the &#8216;Search&#8217; tab.  Search all the table for the OLD-URL with a leading a trailing percent sign like this <strong>%OLD-URL%<\/strong> &#8211; (the percent sign means there can be anything before OR after the search string OLD-URL)<\/p>\n<p>You will be give some results, that will look something like this:<br \/>\n<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.zenutech.com\/kb\/wp-content\/uploads\/2012\/11\/wp_sample_search.png\" alt=\"null\" \/><\/p>\n<p>The most important entries you will need to update are in the <strong>wp_posts<\/strong> table (<em>guid<\/em> and <em>post_content<\/em> columns)and the <strong>wp_options<\/strong> table.  The following search and replace commands can be run in the &#8216;SQL&#8217; tab in phpMyAdmin to replace OLD-URL with the NEW-URL you want to the site to use:<\/p>\n<pre>UPDATE wp_posts SET post_content = REPLACE(post_content, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\nUPDATE wp_posts SET post_content = REPLACE(post_content, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\n\r\nUPDATE wp_posts SET guid = REPLACE(guid, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\nUPDATE wp_posts SET guid = REPLACE(guid, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\n\r\nUPDATE wp_options SET option_value = REPLACE(option_value, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\nUPDATE wp_options SET option_value = REPLACE(option_value, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\n\r\nUPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\nUPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\n\r\nUPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\nUPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\n\r\nUPDATE wp_links SET link_url = REPLACE(link_url, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\nUPDATE wp_links SET link_url = REPLACE(link_url, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\n\r\nUPDATE wp_links SET link_image = REPLACE(link_image, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\nUPDATE wp_links SET link_image = REPLACE(link_image, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\n\r\nUPDATE wp_term_taxonomy SET description = REPLACE(description, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');\r\nUPDATE wp_term_taxonomy SET description = REPLACE(description, 'http:\/\/[OLD_URL]', 'http:\/\/[NEW_URL]');<\/pre>\n<p>\n<strong>OLD-URL<\/strong> will be the URL the WordPress site used on your development environment when all the images and styles showed properly.  It can be something like the following:<\/p>\n<ul>\n<li>http:\/\/localhost:8080\/wordpress\/<\/li>\n<li>http:\/\/dev.yourdomain.com\/<\/li>\n<li>http:\/\/www.yourdomain.com\/wordpress\/<\/li>\n<li>http:\/\/72.10.165.84\/wordpress\/<\/li>\n<\/ul>\n<p>\n<strong>NEW-URL<\/strong> will be the URL the WordPress site will now run as once it is made live.  It can be something like the following:<\/p>\n<ul>\n<li>http:\/\/www.yourdomain.com\/wordpress\/<\/li>\n<li>http:\/\/www.yourdomain.com\/<\/li>\n<li>http:\/\/yourdomain.com\/blog\/<\/li>\n<li>http:\/\/www.yourdomain.com\/<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>How to move a WordPress blog<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[283,279,282,280,281,278,237],"class_list":["post-596","post","type-post","status-publish","format-standard","hentry","category-account-management","tag-export","tag-images","tag-import","tag-missing","tag-move","tag-url","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/posts\/596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/comments?post=596"}],"version-history":[{"count":6,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/posts\/596\/revisions"}],"predecessor-version":[{"id":605,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/posts\/596\/revisions\/605"}],"wp:attachment":[{"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/media?parent=596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/categories?post=596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zenutech.com\/kb\/wp-json\/wp\/v2\/tags?post=596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}