0
votes

hello guys am having trouble from accessing images directly from link on the server, I checked the permissions for all the directories even the images it's self has 755 permission the webpage opens like charming but when I access the image directly like link directly it gives 403 error with no permissions to access the resource

here are some links for the images am trying to access :

https://strongestcard.com/img/offer_photo/022e9691c5ba65d23cbf27a53f83163e.jpg

https://www.strongestcard.com/img/offer_photo/12113835-2.jpg

https://www.strongestcard.com/img/offer_photo/16679.jpg

the website loads fine with no error and the images load fine on the pages but when i but the links giving me the error?

Note : htaccess file exist and working

Solution i had this line inside the htaccess file

RewriteRule .*.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

Changed The letter F to R in [F,NC] to [R,NC]

THANKS TO Quentin .

2

2 Answers

1
votes

Compare a simple request:

[ ~ ] ➜  curl -I https://strongestcard.com/img/offer_photo/022e9691c5ba65d23cbf27a53f83163e.jpg
HTTP/1.1 403 Forbidden
Date: Tue, 21 Jan 2020 10:59:29 GMT
Server: Apache
Content-Type: text/html; charset=iso-8859-1

With one which specifies a referer:

[ ~ ] ➜  curl -I -H "Referer: http://strongestcard.com"  https://strongestcard.com/img/offer_photo/022e9691c5ba65d23cbf27a53f83163e.jpg
HTTP/1.1 200 OK
Date: Tue, 21 Jan 2020 10:59:42 GMT
Server: Apache
Upgrade: h2,h2c
Connection: Upgrade
Last-Modified: Mon, 20 Jan 2020 12:07:49 GMT
ETag: "bec0fcd-2597f6-59c9123e289a1"
Accept-Ranges: bytes
Content-Length: 2463734
Content-Type: image/jpeg

The images appear to have hotlinking protection configured.

htaccess file exist and working

… and it is probably in there (although it could be in the main server configuration file)

-1
votes

This are static files, Looks like the problem is with the file read permission and not with your APP.

For start give the file read permission to everyone and see if the problem is resolved.