Roots Discourse

Multisite + rewrites question

#1

I inherited a multisite that I re-architected into Trellis and I want to rewrite https://subsite1.com/wp-content/uploads/sites/4/2018/(.*) to https://subsite1.com/app/uploads/sites/4/2018/$1. I want to do this instead of making direct changes to the DB because there are external links on external sites relying on the URL with /wp-content/ Typically on single sites I just added a file to /trellis/nginx-includes/subsite1.com/rewrites.conf.j2 and added in something like:

rewrite ^/wp-content/uploads/(.*)$ "/app/uploads/$1" last;

This is not working, and I’m not sure why. My multisite “main” site is multisite.site.com and my wordpress_sites.yml looks like…

multisite.site.com:
    site_hosts:
      - canonical: multisite.site.com
      - canonical: subsite1.com
      	redirects:
      		- www.subsite1.com
      
  

How can I add a rewrite like the one above for the subsite?

0 Likes