Change paths in drupal file table

I seem to use this more and more and the more i use it, the more i seem to forget the syntax.

If, as I do, you develop under client specific subdomains - e.g. clientname.initsix.co.uk, then when uploading content you will find that filepaths have this hardcoded. When moving to live its best practice (in case you dare to remove the dns entry in the future) to remove these temporary subdomains from the table. (backup first!)

update files set filepath = replace(filepath,'clientname.initsix.co.uk','www.clientname.com');

tada! All your files will now becoming from the correct place (remember to move them if you're not using symlinks)

2 Comments

Add new comment