Media Files not loading 404 Error

Your software is v4.1.1
My PHP version is : 7.4.3
My MySQL/MariaDB version is (delete as applicable): MySQL/MariaDB version 10.3.31

Your problem
My problem is :
I’m trying to edit a email segment campaign but i can not see any pictures which are already available in a template. I get 404 errors on the development console and also in the mautic nginx logs.

These errors are showing in the Mautic log :
root@vmd81698:/var/log/nginx# tail -f mautic.error
2022/01/24 15:05:55 [error] 2343442#2343442: *11 open() “/var/www/html/mautic/index.php/media/images/avatar.png” failed (20: Not a directory), client: something.something.something.something, server: server-mautic.domain.com, request: “GET /index.php/media/images/avatar.png HTTP/1.1”, host: “server-mautic.domain.com

Steps I have tried to fix the problem :
I tried to modify the try_files configuration without any success till now.

configuration for nginx on location / is
try_files $uri /index.php$is_args$args;

based on this whenever we would like to open a picture should be reflected as https://mautic.domain.com/index.php/themes/brienz/assets/brienzlake.jpeg?v9318a97f but is 404 error.
If i try to open the file in the following link it works
https://mautic.domain.com/themes/brienz/assets/brienzlake.jpeg?v9318a97f

I tried to query google to provide more details but i end up not finding any solutions.

Thanks,
Adrian

Issue fixed.
The site URL was ending up with index.php, which shouldn’t be the case.

2 Likes

Great, I also had the same issue, and I removed the index.php suffix from the site_url line in mautic/app/config/local.php. It worked.

1 Like

This works for me as well, thanks for your posting that help me