2

My file directories have not changed, but every time I move from local host to production, or just change the filename of a test site online, I loose the images.

For example if I use the backup of prodcution server in local I am getting the path name like below:

http://localhost/sites/all/sites/default/files/images/image_name.jpg

here the project name is missing. thats why I am not getting the images.

I have changed the base_url in local as

http://localhost/project-name

But even that doesn't helps. (Cleared the cache after changing)

Merely this is a duplicate of this question

But I didn't get what I need on that question. Thats why I reposted again.

Any help will be thankful and grateful...

1
  • I found this problem was solved by changing location of the public files to an incorrect location and then back to the correct one. Mar 18, 2014 at 12:33

2 Answers 2

2

Have you tried using http://drupal.org/project/pathologic?

Which way are you using to migrate your database and files? I would also suggest that you clear the cache before exporting.

7
  • I used backup and migrate module to export DB.
    – Fero
    Feb 7, 2013 at 7:58
  • I didn't try this before. But my query is there really neccessary of a module to solve this issue ?
    – Fero
    Feb 7, 2013 at 8:00
  • alright, use pathologic...it will handle the links for you. Don't bother with changing the base-url for now. just install pathologic, backup everything normally then restore it.
    – Chiko
    Feb 7, 2013 at 8:01
  • Yes you have to install that module to handle the links to your files and the paths that you use. with pathologic you would then use relative links to files, it will turn them to absolutes when it needs to
    – Chiko
    Feb 7, 2013 at 8:02
  • Fine.. Let me check and get back to you....
    – Fero
    Feb 7, 2013 at 8:47
0

I wanted to post an alternative solution mainly because I don't think that an Input Format is going to solve all the problems.

Basically, you can follow the instructions below.

  1. Import your database
  2. Within your database editing tool run this code : update files set filepath=REPLACE(filepath, 'sites/OLD_SITE_PATH/files', 'sites/NEW_SITE_NAME/files')
  3. Log into your site and change your paths at

admin/config/media/file-system

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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