Good day. I can not make a redirect from a non-existent image, there is a rule in htaccess:

RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^images/logos/[0-9]+\.[az]+$ images/noLogo.png [L] 

which flatly refuses to work. On lokalkhost everything with a bang. What could be the problem?

  • try to change the name of the picture on no_logo.png - Gena Ant
  • no difference ( - markoffvv
  • Still have rules in .htaccess? - KaZaca
  • KaZats, yes there is, but they do not "interfere" with this in any way - markoffvv

2 answers 2

Maybe I will write nonsense, but ... try instead of images / noLogo.png write /images/noLogo.png

And also check the name of your picture and try the nologo.png option and of course change the name of the picture on the server.

If I’m going to add something else, however, I immediately warn you, I’m not very good at mod_rewrite.

  • I've already tried everything ... By the way, if you make requests like "images / logos / 231123.ggg", well, or similar with an unknown extension, then everything will be fine redirected to "images / noLogo.png"%) ... Google on this topic, I found out that the nginx server is up to apache and he himself is engaged in statics such as images, archives, scripts, styles, and therefore, when requesting a picture, it produces its 404 error page .... In short, I do not think there is a solution here at all, well, if you only ask to configure a hoster on another server .... :( - markoffvv
  • ask the host to ensure that in the absence of a static file the request goes further, I think it is not difficult. although in my opinion if you have a proxy, it should still receive a picture from the backend if htaccess is configured correctly. it seems to me that it is a regular season, but so far I can not say what it is - Sergey

What could be the problem?

judging by the comments, nginx is also used on the server before apache .

Probably, in its settings it is indicated that if the file does not exist, return a response with the code 404.