Or another workaround for this issue?
Situation: I uploaded a pdf file to wordpress and then a week later, had to make some edits to it, so I deleted it and reuploaded. Because the file url had the date in it, the new file has a different url so it messed up a social media post I had created that linked to the file (I realize now I should have used the permalink but I didn’t, will do that going forward) and now it just gives a 404 error. Is there any way to fix that? I tried to do a redirect but apparently that doesn’t work if there’s a 404 error at the server level.
Edit: Thanks for the replies, this is resolved now!
[ad_2]
How did you attempt the redirect? Because that is certainly possible when a 404 occurs.
You need to set the redirect on your server – media and PDFs don’t redirect using standard URL redirection. You can either log into your server and set that redirect, or you can go to your wpcontent folder and manually add your new PDF in the same folder with the same name of the one you previously deleted
Install Redirection plugin, and you can add a 301 permanent redirect from the old URL to the new URL.
Anyone accessing the old file will be sent to the new file.
There’s also a 404 log that shows you all the missing pages and files, so you can catch it there as well, and then just click the respective “add redirection” under the failed 404.
Turn off the date folders setting in WordPress.