Migrating client from wp-engine to trellis based server, currently have been giving out links to media in wp-content... best practice?

Hey –

so I have been using Trellis for a long time and all has been going great for client sites… love the project.

I now ran into an issue that I hadn’t previously. Most of the time I using /app instead of /wp-content hasn’t caused any issues – however this time the client told us, as part of the requirements gathering process, that they have a bunch of badges (just images) that they’ve given out as links to their clients… so basically they have > 500 clients that are showing about 50 different badges at https://foo.com/wp-content/uploads/2017/10/badge.pnghttps://foo.com/wp-content/uploads/2017/10/badge2.pnghttps://foo.com/wp-content/uploads/2017/10/2018-badge.png … etc.

Is there a tried and true way of doing this? create a symlink between /app and /wp-content? switch to wp-content?

What are your guys thoughts…


You could use nginx-includes to make a rewrite rule, or use a WordPress plugin like Redirection to make a regex rewrite. The former is probably more flexible, but the latter is more obvious to someone looking at it. It sort of depends on your needs.

I’d strongly encourage using an nginx rule to just redirect all of those URLs. It’ll be much faster, reduce the load on your server, and won’t depend on WordPress to serve images. Since the rule won’t really ever need to be changed, it should be pretty fire-and-forget. This Stack Exchange answer should point you in the right direction: https://stackoverflow.com/a/34456019

Thanks guys the following rewrite appears to work as expected –

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