tags:

views:

1110

answers:

4

Whats the simplest way to update the paths of the images after migrating the website from local machine to a live server. Most of the times I end up updating the paths manually. I m convinced that there must be a simpler way which i m missing out on.

Kindly suggest.

+1  A: 

Actually I have a multi-site setup on local machine and a single site setup on the live server which is what leads to broken images on deployment. The easiest way to fix this is to update the file path on the server using a simple SQL query. UPDATE files SET filepath = REPLACE(filepath, 'old/path', 'new/path');

Saurabh
@Saurabh: I've encountered this problem also. Have you since then found out a more elegant way of solving this problem?
Sid NoParrots
BTW this issue is fixed in Drupal 7. You no longer need to replace the path prefix as described above.
Sid NoParrots
+1  A: 

My guess is that the issue you're seeing is a result of not setting the filepath in the administration. If you go into the administration (admin/settings/file-system) and simply save the page, you'll define the value for the filepath (which should remove the issues).

You could also set all files to use the original default (or local) directory as well via that interface.

The issue, in case you're wondering, is that the variable_get call under the hood for the filepath is dynamic based on the sites directory that you're loading the settings.php file from. Once the value is set, it no longer resorts to the default setting and uses your value instead.

If you're physically moving the files from the relative location they're at locally vs on the server, then I'm not sure there's much of a great way around that issue.

William OConnor - csevb10
Ok .. thanks for the reply. However I have tried changing the path using the file system in the past without much success . Though the next time I copy a single site frm the multi-site setup i have on my local machine and configure it individually on the live server would certainly try nd check it again. THanks
Saurabh
A: 

My image links are also broken ... I Inspect all the thing ... image are at right place sites/default/files/ .... and image path is absolutely right ... but don't understand what the problem is ... plz give some suggestion

ahsan
try clearing the cache tables in the database. At times that too helps.
Saurabh
A: 

Blockquote Actually I have a multi-site setup on local machine and a single site setup on the live server which is what leads to broken images on deployment. The easiest way to fix this is to update the file path on the server using a simple SQL query. UPDATE files SET filepath = REPLACE(filepath, 'old/path', 'new/path');

Very helpful, thank you!

Yaddoshi