We have a site built with WordPress with nginx
web server. I want to do multiple redirection in one line of code in our nginx
file.
The code below runs smoothly:
location /wp-links-opml.php {
return 301 https://$host/page-not-found;
}
What I want to happen is redirect multiple files in just one config:
location /wp-links-opml.php /wp-config-sample.php /wp-load.php {
return 301 https://$host/page-not-found;
}
All of the files above belong in root
directory but nginx
prompts with nginx exited with code 1
Do you know how can I properly redirect multiple files in 1 config?
Note: I tried this How can I have same rule for two locations in NGINX config? but in my case I am working with php files and not locations
Any help is greatly appreciated. Thanks.