1

I have a number of websites that were previously on a Windows IIS environment. We migrated them over to Linux and of course all of the links to media files are now broken because Linux is case sensitive and Windows isn't (most of the files are PDFs uploaded by end-users, so the naming conventions are all over the place).

Is there any sort of shortcut to fixing these links? Any plugins out there that search for media links and correct the case? Doing this manually on 20 websites is going to be a nightmare so any suggestions are appreciated, even if it involves regex or MySQL voodoo.

  • are you trying to change the references to the files (db) or change the names of the files directly? – rudtek Dec 15 '17 at 19:28
  • I'd rather leave the files themselves untouched. In the Media Library the links match the files, but any link placed on a page or post is lowercase and needs to be fixed. If that makes sense. – Sabrina Dec 15 '17 at 20:04
  • So you're trying to make the references all uppercase? title case? including extensions in the references? – rudtek Dec 15 '17 at 21:19
  • I'm just trying to get them to match the case of the filename. It varies wildly because end users have unreliable capitalization. If there was a way to do a search & replace that would remove the lowercase links and replace them with the proper Media Library references, that would be ideal. Search for links to *.pdf > check db for matching reference > replace link with proper reference from db. – Sabrina Dec 15 '17 at 21:43
  • hrm. I am not sure how to start a search to match references to file names without a pattern to match. – rudtek Dec 15 '17 at 22:24

Your Answer

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

Browse other questions tagged or ask your own question.