Alright, Roots Community,
You all were instrumental in helping me understand capabilities with Trellis in the past, and as a junior developer, I can use all of the help I can get. I believe this is an NGINX related question however I would love any other solutions that help achieve the same mission of redirecting URLs to different paths. I am looking to be able to do two things on a Roots installation to help clean up some items on a WordPress site I am playing with:
-
I have a present multisite set-up with a domain of foo.maindomain.net, and I would like to see if I can remap the domain and subsequent URL’s to maindomain.net/foo. I believe this is as simple as an upstream and proxy pass, however, I am not getting any actionable results. I have placed my NGINX includes files in the right directory as outlined in the Trellis Documentation here, however I am getting quite a few “directive is not allowed here” errors. I am still very new to NGINX and it’s capabilities, so I may be using NGINX incorrectly, or perhaps shouldn’t be using it at all. The code I attempted to use in my local dev environment in the proxy.conf.j2 file can be found below…
upstream build_change_annual_reports {
server 127.0.0.1
}server {
listen 80;
location /annualreports {
#trailing slash is vital to operation
proxy_pass https://annualreports.buildchange.test/;
}
} -
Lastly, I have another redirection related question: I am working with an existing Wordpress site that unfortunately has a quite few files in a directory outside of Wordpress and it’s core file structure. For security, I have brought those files back into the roots directory, but now need to find a solution for users who have existing links to these files. I preferably don’t want to run a 301 request for each of these files as there are some 300 or so files that were once in the external directory. The goal at the end of the day is to take any file that was once in the /pdfs/ directory and convert it to the Roots-based /app/uploads/ directory instead.
Any help would be greatly appreciated, and I acknowledge these questions may not be directly related to Roots, however, given my little knowledge of NGINX, I have normally been able to scrape by. Given that Roots has now entered my stack, I haven’t figured out how to work through these two issues just yet. If you have solutions for either of these issues not related to NGINX, feel free to pitch them too.
Thank you for your help in advance!