Answer the question
In order to leave comments, you need to log in
Should all requests from any php file be transferred to index.php?
How to make it so that all requests from any php file are transferred to index.php, without checking for the existence of a file (try_files), through Nginx?
Now the server has a routing setup, that is, if the file does not exist, then it returns index.php. However, if you call example.com/func.php
through the address bar , this file will open.
Answer the question
In order to leave comments, you need to log in
Found the answer:
location ~ \.php$ {
...
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
...
}
try_files is needed to serve static (css, js, jpg/png, etc.)
func.php and other includes should not be accessible from the web! Move them up a level.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question