last day (15 days later) » 

19:26
1
Q: set up 301 redirect within wp-content/uploads/ directory of a WP site to a new image URL

kawnahI need to do a redirect within wp-content/uploads/ - to a new image name, because the old one doesn't work. How do you do this? I want to redirect from https://example.com/wp-content/uploads/2021/09/image-1.png to https://example.com/wp-content/uploads/2021/09/image-2.png - I tried using both of ...

And what do you mean exactly when the redirect "didn't work"? What response do you get? Any error? A WP 404 response? An Apache 404 response? Or something else?
to clarify 404 nginx
"nginx"?! How does Nginx fit into your config? Nginx does not use .htaccess. And to clarify, the original image (ie. image-1.png) does not exist on the filesystem?
idk sorry I'm mostly Front End I don't really do or understand server side.
I just get 404 with an <hr> and under it it says nginx
You need to clarify your server config. Are you using Nginx as your only server? Or are you using Nginx as a front-end caching proxy in front of Apache and Apache is your application server?
Did the old image (image-1.png) used to exist and it was later deleted?
19:27
Okay I see, so we're on Apache but idk how nginx plays into that. Probably our firewall or something?
And yeah it did exist at one point but it got overwritten when I did an enviornment copy/transfer on WP Engine
It's relatively common to have an Nginx front-end proxy (in front of Apache) that is used to serve static assets (images, CSS, JS etc). What you may be seeing is either a cached response from the proxy OR the proxy is configured to serve all requests to /wp-content/uploads bypassing your application server (ie. Apache) entirely.
You need to find out the role that Nginx is playing here as this may need to be configured to allow the request through to the backend so you can configure the redirect.
What kind of hosting are you using?
WP Engine
 
2 hours later…
21:48
tl;dr you'll probably need to contact your host (WPEngine) to get to the bottom of this.
Either...
1. You are on an Nginx server, so .htaccess does not apply. You would need to perform this redirect in WordPress itself (eg. using a plugin). However, this "plugin" does not appear to be working, which leads me to believe...
2. You are on Apache, but there is a Nginx front-end proxy that is configured to serve static content (from /wp-content/uploads). The request for these resources (or this area of the filesystem) is handled entirely by Nginx. The request does not even reach Apache/WordPress, which is why you are seeing an Nginx generated 404 response.
The Nginx proxy needs to be configured to allow requests through to Apache so you can implement the redirect (or the redirect is implemented in the Nginx server config, which you probably don't have access to?). This probably requires a support request with the host.
@kawnah (See above)

last day (15 days later) »