Answer the question
In order to leave comments, you need to log in
How to make a 404 page when requesting txt,html file extensions in the address bar on wordpress + nginx? And how to set dynamic robots.txt?
1) When requesting a directory, for example, localhost/folder or localhost/folder , the correct 404.php page from wordpress is given. But when I try to write localhost/folder.txt or folder.html like this, I get a 404 page from nginx. I know that something needs to be registered in the nginx config, but I don’t know what.
2) How to set up dynamic robots.txt in WordPress, again, due to the fact that txt files are processed by nginx, it is impossible to make virtual robots.txt, something needs to be written in the config. I would like to register such a config that in general will give all file extensions for processing by php if php starts working with one of these extensions.
Answer the question
In order to leave comments, you need to log in
Found a way
location ~* ^.+\.(.+)$ {
try_files $uri $uri/ /index.php?$args;
log_not_found off;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question