using symlinks to redirect app/uploads to wp-content/uploads --> this worked so far, but will result in different image paths for new and old media files, which might bring us in to even bigger trouble in future
redirecting via redirection-plugin (not good for performance and google might not like this)
changing paths in bedrock, so that media-files will live in wp-content/uploads. what are pros cons here and if possible how would I accomplish this?
Are there better solutions for this? Probably I’m not the first one with this problem, but couldn’t find suitable answer on the forum yet …
You could directly change the nginx config template for that site and add a redirection on nginx-level.
IMHO Google doesn’t care whether the redirection headers were emitted by a redirection plugin or by nginx, in the end the right HTTP redirection code matters.
in order to keep a page wp-path-consistent (who knows if the client wants to move back to a normal wp-install one day), is there any possible solution of telling bedrock to put the uploads-folder where it originally belongs (in wp-content)? or will this be a problem when updating wordpress?
When I did rerouted web/wp/wp-content to web/app via symlinks (and search-replaced image-paths back to wp-content/uploads in db), it worked for the original image files, but th srcset-files still had the bedrock-paths.
I didn’t understand why … are the srcset-paths dynamicaly generated instead of being called from the db? and anyway how does wordpress suddenly know (after migration), that the image-path has changed? I didn’t do any search-replace for this. is there already a nginx-rewrite-rule implemented in bedrock or so?
I wish I were better with nginx as well. If you’re using Trellis, I’m pretty sure you can set that up to make sure all environments are the same… I’m not a trellis guy, though… yet. So I, unfortunately, cannot confirm the config as you have stated.
On my digital ocean server I typically edit the config file for the specific site I’m working on, and just add that location block near the rest of the location blocks…
As far as I know, you would need to restart nginx with any conf changes.
The $1 is the variable that comes from the first (.*)$. It represents everything after /wp-content/ from the incoming string.
Hello. How do I do the same trick on apache?
For SEO I need the links to be wp-content / uploads, not app / uploads.
Thousands of photos have already been indexed.
I really look forward to your answer, thanks!