Bobcares

How to resolve WordPress “missing images” and “missing files” errors in a DirectAdmin server

by | Oct 8, 2014

All WordPress images have disappeared!
My wordpress site is broken!
My WordPress style sheet is gone!

Missing images and files are common issues in WordPress sites hosted in DirectAdmin servers. A wide variety of changes ranging from file permissions to web application firewalls can cause these errors.

WordPress sites are usually image intensive, and missing images significantly affect the website’s reputation among its user base. Bobcares help desk support services resolve these issues as quickly as possible to minimize site downtime. Listed below are a few of the common causes we’ve seen for missing images and files in a WordPress website.

Wrong SiteURL

WordPress keeps track of itself through WP_SITEURL and WP_HOME. WP_SITEURL tells WordPress where the WordPress files are located, and WP_HOME defines what visitors need to type in the address bar to see the site. Usually when a WordPress site is migrated, or a domain name is changed, or a site is installed in a temporary URL, the WP_SITEURL setting could be set wrong. We’ve seen that this usually shows up as missing images in home page, WordPress redirecting to old site, missing custom styles of the website, and inability to login to admin page.

To resolve this, just update the WP_SITEURL and WP_HOME URLs in wp-config.php with the current path of WordPress.

Third party plugins breaking paths

In DirectAdmin shared hosting, web masters try out myriad different WordPress plugins. While some plugins are very well coded, some (especially security plugins) break WordPress settings and file permissions. In troubleshooting missing images, we test recently installed or updated plugins. In a surprisingly significant number of cases, poorly coded plugins were seen to break image paths.

Improper permalink configuration

In WordPress sites that have custom modified files, and those that were installed using script installers (like Softaculous), missing images are reported when Permalink settings are changed.
If the customer has custom modified files, we change the relative paths in it into absolute paths. For eg:

<img src="/wp-content/themes/mysandtheme/images/header.png" alt="mydomain.com" width="600" height="50" border="0"/>

Script installers like Softaculous might be unable to update .htaccess due to insufficient write permissions. So, in such cases, we look for proper permissions and an entry like below in .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Errors in .htaccess

We sometimes see incorrect ReWrite entries in .htaccess files. WordPress relies heavily on ReWrite rules, and if a custom rule conflicts with the basic configuration entries put in by WordPress, the images will show up blank. Modification time of .htaccess file is one of the first things we note in such cases, and if the ReDirect rules are non-standard, we analyze the rules to locate the mis-configured entry. More often than not, these issues are caused by the web master’s lack of understanding on image paths vis-a-vis where WordPress is expecting them.

Images uploaded to wrong location (path)

Sometimes during WordPress site migrations, web masters upload files to the images folder instead of the wp-content/uploads folder. In recently migrated sites, we note the modification time of the images directory, and fix the issue by moving the images to the right directory (as obtained from the database). The path to images can be obtained from the guid field of posts table.

Wrong file permissions

Web site migrations can quickly go out of hand when done without due understanding of what all can go wrong. We have seen that, sometimes during a migration, a web master would give wrong permissions to directories and files. A directory would ideally need 755 permission, and files will need 644 permission to be retrievable by WordPress. This can be quickly fixed by locating the errant files using a find command, and feeding the list to a chmod command.

Wrong file ownership

When a WordPress site is migrated to a new server, or when it is retrieved from backup, it is possible that the ownership of files and directories would be incompatible with the new server settings. This sometimes happens with reseller hosting where a superuser will be able to put files into another user’s account. We uncover these problems in the initial couple of commands where the requisite ownership and permission requirements are checked.

Web Application Firewall restrictions

Some servers would be equipped by web application firewalls like mod_security. We have seen that some servers which have paranoid settings in web application firewalls cause some URLs to be blocked. Eg: If a URL contain “/etcetera.jpg”, some poorly written paranoid rules can reject it based on the presence of the string “/etc“.

We quickly locate these issues by looking at the web server error code shown in the log files.

Hotlink protection

Depending on how the images are references in a WordPress site, sometimes a change in site settings can cause image blocks. For eg: If the site name was recently changed to “www.domain.com“, and the images are referenced as “domain.com/path/to/image.jpg“, it can trigger a hot link condition, and block access to the image. We locate such issues by comparing the image URL with the site URL.

PHP settings

Some plug-ins require image URLs to be specified in full HTTP address format, and when supporting settings such as allow_url_fopen is not enabled, it leads to images to be irretrievable. We detect these issues by analyzing the log files, and such special requirements are met by modifying the account level PHP settings.

The above are the most common reasons for missing images or files errors in WordPress websites, and we keep adding to the list as WordPress keeps evolving. In our help desk support services, we rely on systematic troubleshooting, which enables us to quickly and accurately resolve any WordPress issue reported by web masters.

Looking for a better help desk support experience for your customers? Check out our Help Desk support features below:

Take me there!

 

0 Comments

Never again lose customers to poor
server speed! Let us help you.