0

I sent an email to some folks today with a link to a word document hosted on wordpress. The URL in the email is something like:

www.mycompany.com/media/2018/06/somedocument.docx

Unfortunately, somedocument.docx actaully resides at:

www.mycompany.com/media/2018/05/somedocument.docx

When people click the link in the email, they get a 404. We have tried a 301 redirect from one to the other, but that doesn't seem to work. I'm assuming that's because it's a direct link to a file and not a normal HTTP request?

We have already sent a follow-up email with the correct link, but we'd like to fix the issue as well so that when someone clicks the original link in the email, they get redirected to the actual document instead of a 404. Does anyone know how to accomplish this? Thanks.

  • Do you have access to an .htaccess file?? – ChristopherJones Jun 11 at 15:16
  • I didn't think to check - I'm saying "I" here but really this is a colleague of mine. Let me grab the WP credentials and take a look myself, I'm sure we do. – Adam Rosenscruggs Jun 11 at 15:19
0

If you have access to the .htaccess file, a quick 301 redirect should fix that for yah!

Redirect 301 /media/2018/06/somedocument.docx https://www.mycompany.com/media/2018/05/somedocument.docx

(If you don't there are other ways to handle it inside the theme if you need to.)

  • I hate hosted wordpress so much but I finally got this working, thanks for your help! – Adam Rosenscruggs Jun 11 at 15:51
  • 1
    For anyone else reading this in the future, I have just learned that the redirect tool built in to WP would have worked if only we had escaped the damn . in the URL. Oh well, it's not like I would have put this hour to any better use. – Adam Rosenscruggs Jun 11 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.