403 forbidden error for Image

Posted on : Thu, 24th Sep 15 05:35 am UTC
100+ votes

Recently I saw that some of the images were not displayed on a particular webpage, i checked if the image was available under the the images folder, yes it was with the correct name!

I checked the Chrome Browser's console logs and It said : GET http://localhost/myapp/images/4.jpg 403 (Forbidden). I tried accessing the image via url and I could see this access type error!

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

Apache/2.4.10 (Unix) OpenSSL/1.0.1i PHP/5.5.15 mod_perl/2.0.8-dev Perl/v5.16.3

Reason for 403 : Well it was obvious that it has something to do with the access permissions of the file, as I work on a unix based operating system.

Solution to resolve 403 forbidden error :

Check the access permissions for the file : Read permission should be allowed for the Others , its best to make permission settings to 644 using CHMOD

644 = (rw- r-- r--): group/others can to read the file. Owner can write to it, others cannot write or execute it.

Hope it helps someone!

Code2care's mission is to share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities so that our visitors can leverage this portal to find solutions to their queries without re-inventing the wheel. Technical posts include Learnings, Tutorials, Video Tutorials, Code Snippets, Tips-n-tricks.

Follow us : Facebook - Twitter - Google +