{"id":8255,"date":"2017-08-14T01:37:58","date_gmt":"2017-08-14T06:37:58","guid":{"rendered":"https:\/\/krisbunda.com\/blog\/?p=8255"},"modified":"2017-08-20T23:14:34","modified_gmt":"2017-08-21T04:14:34","slug":"how-to-fix-your-missing-wordpress-images","status":"publish","type":"post","link":"https:\/\/krisbunda.com\/blog\/2017\/08\/14\/how-to-fix-your-missing-wordpress-images\/","title":{"rendered":"How To: Fix Your Missing WordPress Images"},"content":{"rendered":"<h2>My images disappeared, and I got 404 Errors when trying to direct access their URLs.<\/h2>\n<ul>\n<li>Most of my images were suddenly missing in WordPress, but when I FTP&#8217;d into my &#8220;wp-content\/uploads\/&#8221; folders, they were all there.<\/li>\n<li>Also&#8211;I couldn&#8217;t directly pull them up even when typing in their direct URL. That was the tipoff. I actually got the answer from<a href=\"https:\/\/www.drupal.org\/node\/256410\" target=\"_blank\" rel=\"noopener\"> this Drupal site<\/a>.<\/li>\n<\/ul>\n<blockquote>\n<h4 id=\"htaccess-corrupt\">3. Your .htaccess file is corrupt.\u00a0<a href=\"https:\/\/www.drupal.org\/node\/256410#htaccess-corrupt\" target=\"_blank\" rel=\"nofollow noopener\">#<\/a><\/h4>\n<p>The .htaccess file is very fussy, and only works if things are in a certain order. If you&#8217;ve tried to add password protection or to block image hotlinking (especially if you used cPanel or some other software to set that up), you&#8217;ve probably corrupted the file. The simple solution is to delete your corrupted .htaccess file, then upload the standard version that comes with Drupal.<\/p><\/blockquote>\n<p>So there you have it. I had recently been puttering around in my cPanel (usually a bad idea) because I came across a &#8220;Ten Easy Steps To Win The Internet&#8221; post about making my site load faster, and I decided to make sure image hotlinking only worked from domains hosted on my server. Well, apparently when you do that, Apache gets all huffy and screws up the .htaccess file.<\/p>\n<h4>Have you been messing around in your server&#8217;s settings lately?<\/h4>\n<h3>How To Fix It:<\/h3>\n<p>In the folder that my WordPress\u00a0installs in (subfolder <span style=\"color: #ff6600;\">\/blog<\/span> in this case), I got rid of the current <span style=\"color: #ff6600;\">.htaccess<\/span>\u00a0file (by renaming it to <span style=\"color: #ff6600;\">.htaccess.copy1<\/span>) and added a new one, a text file I pasted the following script in:<\/p>\n<pre># BEGIN WordPress\r\n&lt;IfModule mod_rewrite.c&gt;\r\nRewriteEngine On\r\nRewriteBase \/<span style=\"color: #ff0000;\"><strong>blog\/<\/strong><\/span>\r\nRewriteRule ^index\\.php$ - [L]\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule . <span style=\"color: #ff0000;\"><strong>\/blog<\/strong><\/span>\/index.php [L]\r\n&lt;\/IfModule&gt;<\/pre>\n<h3>Important: Is Your WP installed in a Subfolder?<\/h3>\n<p>Remember, if you think you need redo your htaccess file, and you install your wordpress\u00a0at your root folder (as many people do) instead of a \/blog subfolder like me, do not put the &#8220;blog\/&#8221; part in the &#8220;RewriteBase&#8221; &amp; &#8220;RewriteRule&#8221; lines. Instead, copy this below, or <a href=\"https:\/\/codex.wordpress.org\/htaccess#Basic_WP\" target=\"_blank\" rel=\"noopener\">go to this wordpress\u00a0site<\/a> and copy whatever they&#8217;re doing nowadays.<\/p>\n<pre># BEGIN WordPress\r\n&lt;IfModule mod_rewrite.c&gt;\r\nRewriteEngine On\r\nRewriteBase <strong><span style=\"color: #ff0000;\">\/<\/span><\/strong>\r\nRewriteRule ^index\\.php$ - [L]\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule . <strong><span style=\"color: #ff0000;\">\/<\/span><\/strong>index.php [L]\r\n&lt;\/IfModule&gt;\r\n# END WordPress<\/pre>\n<p>Again, if you installed your WP in a different location, here&#8217;s how that will have to work:<\/p>\n<p>Like, if you&#8217;re WP blog is installed at:<\/p>\n<pre><span style=\"color: #000000;\">http:\/\/helloworld.com\/subfolder\/subfolder2\/ <\/span><\/pre>\n<p><span style=\"color: #ff6600;\"><span style=\"color: #000000;\">then you need to type as the 4th line above:<\/span><\/span><\/p>\n<pre><span style=\"color: #333333;\">RewriteBase \/<strong><span style=\"color: #ff0000;\">subfolder\/subfolder2\/ <\/span><\/strong><\/span><\/pre>\n<p><span style=\"color: #ff6600;\"><span style=\"color: #000000;\">\u00a0and as\u00a0the 8th line above:<\/span><\/span><\/p>\n<pre><span style=\"color: #ff6600;\"><span style=\"color: #000000;\">RewriteRule . <strong><span style=\"color: #ff0000;\">\/subfolder\/subfolder2<\/span><\/strong>\/index.php [L]<\/span><\/span><\/pre>\n<h3>Here&#8217;s a step-by-step.<\/h3>\n<ol>\n<li>Open a new text file (&#8220;Notepad&#8221; app, or whatever you like).<\/li>\n<li>Paste the most appropriate version of the htaccess script in it.<\/li>\n<li>Save the text file as &#8220;<strong>.htaccess<\/strong>&#8220;<\/li>\n<li>Open an ftp window to your website, navigate to where your WordPress install folder is. (for me, with cPanel, it&#8217;s a folder named: &#8220;ftp:\/\/blahblah.com<strong>\/public_html<\/strong>&#8221; and then a subfolder &#8220;<strong>\/blog<\/strong>&#8220;)<\/li>\n<li>Find the current <strong>.htaccess<\/strong> file (it may be the culprit even if you don&#8217;t see anything wrong with it). Rename it to <strong>.htaccess.copy1<\/strong>, or something different.<\/li>\n<li>Copy and paste the <strong>.htaccess<\/strong> file you made earlier into the folder.<\/li>\n<li>Now reload your website, and see if your images are back. Mine were.<\/li>\n<\/ol>\n<h4>If this is all Greek to you, try calling your web hosting company for support, it&#8217;s probably the fastest way for you to get this fixed.<\/h4>\n","protected":false},"excerpt":{"rendered":"<p>If your WordPress images disappeared and you can&#8217;t even direct access them via url, maybe replace your .htaccess file. It&#8217;s easy, here&#8217;s how.<\/p>\n","protected":false},"author":1,"featured_media":8257,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","inline_featured_image":false,"kt_blocks_editor_width":"","_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[95,177,633,36,105,240],"class_list":["post-8255","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-designer","tag-computer","tag-instructions","tag-server","tag-tutorial","tag-web-design","tag-wordpress"],"aioseo_notices":[],"jetpack_publicize_connections":[],"taxonomy_info":{"category":[{"value":4,"label":"Designer"}],"post_tag":[{"value":95,"label":"computer"},{"value":177,"label":"instructions"},{"value":633,"label":"server"},{"value":36,"label":"tutorial"},{"value":105,"label":"web design"},{"value":240,"label":"WordPress"}]},"featured_image_src_large":["https:\/\/krisbunda.com\/blog\/wp-content\/uploads\/2017\/08\/youve-got-htaccess-probs.png",500,500,false],"author_info":{"display_name":"Kris Bunda","author_link":"https:\/\/krisbunda.com\/blog\/author\/kris-bunda\/"},"comment_info":0,"category_info":[{"term_id":4,"name":"Designer","slug":"designer","term_group":0,"term_taxonomy_id":4,"taxonomy":"category","description":"Posts focusing on web, graphic, CAD, and other design.","parent":0,"count":91,"filter":"raw","cat_ID":4,"category_count":91,"category_description":"Posts focusing on web, graphic, CAD, and other design.","cat_name":"Designer","category_nicename":"designer","category_parent":0}],"tag_info":[{"term_id":95,"name":"computer","slug":"computer","term_group":0,"term_taxonomy_id":95,"taxonomy":"post_tag","description":"","parent":0,"count":12,"filter":"raw"},{"term_id":177,"name":"instructions","slug":"instructions","term_group":0,"term_taxonomy_id":177,"taxonomy":"post_tag","description":"","parent":0,"count":28,"filter":"raw"},{"term_id":633,"name":"server","slug":"server","term_group":0,"term_taxonomy_id":637,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":36,"name":"tutorial","slug":"tutorial","term_group":0,"term_taxonomy_id":36,"taxonomy":"post_tag","description":"","parent":0,"count":33,"filter":"raw"},{"term_id":105,"name":"web design","slug":"web-design","term_group":0,"term_taxonomy_id":105,"taxonomy":"post_tag","description":"","parent":0,"count":19,"filter":"raw"},{"term_id":240,"name":"WordPress","slug":"wordpress","term_group":0,"term_taxonomy_id":240,"taxonomy":"post_tag","description":"","parent":0,"count":5,"filter":"raw"}],"jetpack_featured_media_url":"https:\/\/krisbunda.com\/blog\/wp-content\/uploads\/2017\/08\/youve-got-htaccess-probs.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1NcZe-299","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/posts\/8255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/comments?post=8255"}],"version-history":[{"count":5,"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/posts\/8255\/revisions"}],"predecessor-version":[{"id":8321,"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/posts\/8255\/revisions\/8321"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/media\/8257"}],"wp:attachment":[{"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/media?parent=8255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/categories?post=8255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/krisbunda.com\/blog\/wp-json\/wp\/v2\/tags?post=8255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}