Answer the question
In order to leave comments, you need to log in
Nginx: How to rewrite all root requests to index.php?
Where is the error in the nginx config?
It is necessary to make sure that when calling any file from the root of the site (even if it does not exist), there will
be a redirect to /index.php without replacing the URL in the
browser
.
location ~ /[^\/]+ {
rewrite ^/[\w\W]+$ /index.php;
}
location ~ /[^\/]+ {
rewrite ^/[^\/]+$ /index.php;
}
location = /robots.txt {
rewrite ^/robots.txt$ /robots.txt.php;
}
Answer the question
In order to leave comments, you need to log in
Something like this:
location = /index.php {
# тут проксирование или fcgi
}
location ~ /[^\/]+ {
rewrite .* /index.php;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question