Search code examples
apachepng

my website refuses to serve .png files


When moving a site from a staging environment to a production environment, .png image files are not being shown. When going to the image directly, firefox reports:

The image (image-path) cannot be displayed, because it contains errors.

I've checked mime.types in my apache config, and it contains a line for

image/png png

does anyone know what could be causing this? I've never encountered this before.


Solution

    1. check .htaccess file url rewrite or any permission/restrictions etc.

    2. upload any png image and try to open it browser using direct path to ur png file. such as http://localhost/images/test.png (if it works fine, it means your apache process your png successfully fully)

    3. check if you have created any symbolic link your images directory in your previous server(host).

    4. check your directory permissions.

    5. clear your browser cache.

    6. check your appach virtual host file httd.conf in your preivous host. may be previous there has been created some alias or something like that. httpd.conf: ...

       <VirtualHost www.mydomain.com:80>
                   ServerAdmin hostmaster@www.mydomain.com
                   DocumentRoot /home/www/www.mydomain.com/htdocs
                   ScriptAlias /cgi-bin/ /home/www/www.mydomain.com/cgi-bin/
                   ServerName www.mydomain.com
                   Alias /images/ /home/www/www.mydomain.com/images/
                   Alias /pictures/ /home/www/www.mydomain.com/upload/
                   Alias /errors/ /home/www/www.mydomain.com/errors/
                   Alias /catalog/ /home/www/www.mydomain.com/catalog/
                   ErrorLog /home/www/www.mydomain.com/logs/error_log
                   CustomLog /home/www/www.mydomain.com/logs/access_log
                   ScriptLog /home/www/www.mydomain.com/logs/script_log
                   ErrorDocument 403 /errors/403.html
                   ErrorDocument 404 /errors/404.html
                   ErrorDocument 500 /errors/500.html
           </VirtualHost>
      

    let me know if any of this works or not