Answer the question
In order to leave comments, you need to log in
How to redirect request to index.php when there is no file in the directory?
There is such a link https://site.ru/tmp/images/products/kamaz.360x270.jpeg
Naturally, such a file does not exist, but when following this link, if the file does not exist, I need to redirect the request to the index.php file and there already process the link with a router and create the desired file.
The problem is that the design
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
Answer the question
In order to leave comments, you need to log in
Valera Karmanov , that is, you use .htaccess for the Apache web server and are you not embarrassed that the nginx web server gives a 404 error?
With a probability of 100%, you have nginx, followed by apache, which already runs php.
That is, the user's request first comes to nginx, and then it is already sent to apache or not sent.
And nginx is configured so that if this is a request for a static file, in your case .jpg, then it is not passed to apache, but 404 is issued and therefore .htaccess does not work.
The solution is to configure nginx properly.
The option of creating a separate index.php file in the tmp folder is not suitable!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question