Answer the question
In order to leave comments, you need to log in
How to make a virtual redirect to an index file using Nginx?
Welcome all.
There is an index.php file, there is the main page of the site. For some reason, the CMS will not detect the homepage and will display its own 404 error. At the same time, if you explicitly go to the address: https://example.com/index.php everything works and the main page opens. The index file in the Nginx config is set correctly. index index.html index.php;
Well, actually it works, since the main page of the site opens, the error is most likely somewhere on the application side. But in view of the lack of such experience, I do not know where to look for it. Now I temporarily solved the problem like this:
if ($request_uri = "/") {
return 301 "/index.php";
}
Answer the question
In order to leave comments, you need to log in
I will assume that a redirect from http to https is done in this way
server {
listen 80;
server_name example.com;
return 301 https://$server_name;
}
https://$server_name$request_uri
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question