Server not serving images

Currently I have an application that works fine locally. After uploading it the server, none of the images will load. The links are served to the correct address however they 404. My images are located in the /assets/images/ from the root of the subdomain. my links are as structured:

http://sub.example.com/assets/images/filename.png

I know they are physically there as I can see them from both cpanel and in ftp. All the other folders and files in the assets directory load properly js, css,videos, fonts, etc) on the server. Even the css files get 404 errors when requesting images via relative pathing.

../images/image.png  

I thought this might be a file permissions error. I checked the assets and assets/images/ and both folder is listed as a 755 for permissions which is correct. I briefly tried 777 on the images folder including its subfolders and files just to see, but made no difference.

my .htaccess in the root is as below. It currently routes the rest of my application properly.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

After reading into some other posts around this topic, I went to check to see if if it was just png files, I found that svg, jpg, gifs also don't load.

At this point I am kinda lost on where try to try next.


Just out of curiosity. Do you get the same problem if you replace all the content in your .htaccess file with the following:

RewriteEngine on
RewriteCond $1 !^(index.php|application|assets|favicon.ico|robots.txt)
RewriteRule ^(.*)$ /full/path/www/index.php/$1 [L]

Replace /full/path/www/ with the absolute pathname to your root folder.

I use this approach for both CI 2 and 3 applications, working on my home server as well as on shared hosts.

链接地址: http://www.djcxy.com/p/41298.html

上一篇: 网页内容不会在每台计算机上进行压缩

下一篇: 服务器不提供图像