I moved a site from one domain to another. All of the files in the "files" directory were copied over. Everything looks good with the display just like the old site, but when I click the file link on a node I'm getting a Page Not Found, which I'm sure is because the address is looking like this:

http://www.NewSite.com/sites/NewSite.org/files/sites/OldSite.com/files/f...

Any suggestions for how to get this fixed sitewide?

Comments

quicksketch’s picture

You need to update the paths stored in Drupal core's "files" table to reflect your new location. For this reason, I always use a symlink for the domain name to a shorter name that stores the real files (like "NewSite.com" symlinked to "sitename"), this way you don't run into this problem. This has been brought up many times before because of the way Drupal core stores entries in the "files" database table, it's not something FileField can correct.

brisath’s picture

Status: Active » Closed (fixed)

Thanks. I used phpMyAdmin to edit the "files" table for each file to remove the preceding "sites/OldSite.com/files/" on each and it seems to have solved the problem. Fortunately, I didn't have many files so this was an easy fix. @quicksketch Unless you foresee any problems with what I did, then I think this is resolved. I didn't quite understand your first symlink solution, but I might have to investigate that further.