0

So I recently migrated my site between servers. I think this is causing some issue with the base path of drupal, which in turn affects the image upload path when a user tries to upload an image to his/her profile.

So, before migrating, some data was already uploaded to some of the users and their images and paths work just fine. The path is as follows for example:

www.example.com/sites/default/files/styles/thumbnail/public/pictures/picture-125-1377507580.jpg

But now, when I'm trying to add new users and when I upload new pictures, the image doesn't get uploaded and the path to the image is as follows:

www.example.com/new/?q=sites/default/files/styles/thumbnail/public/pictures/picture-125-1377507580.jpg

Why is this happening? How do I change the drupal base path?

Thanks

  • Can you provide your code how you are saving image? – Sumit Madan Aug 26 '13 at 12:09
  • I didn't manually write the code for saving the images. Images are saved directly by Drupal. – KaushikTD Aug 26 '13 at 12:16
  • Whether or not this solves the problem, you can change the $base_url in sites/default/settings.php – Geoff May 10 '14 at 22:36
  • You just need to enable clean urls from admin (admin/config/search/clean-urls). Just check mod_rewrite is enabled on sever – Ashish T Aug 22 '14 at 4:59
  • Are you sure you copied the .htaccess file as well? – Wim Mostrey Jan 15 '17 at 3:09
0

Firstly, it seems that the new server does not allow clean urls or it needs some configuration. Check the documentation on Drupal.org: Step 6: Configure clean URLs

Then, clean all caches and run cron. You will then see all image paths as /new/sites/sites/default/files/...

That's because the new site is set on folder ROOT/new or am I wrong? So there is no error, you have to set the domain to look at this subfolder.

If you don't have permissions to do this in your hosting or there are no options like Add-On domains you can follow the discussion at Drupal installed in subdirectory but made to appear in root according to your hosting enviiroment.

  • Alright, so I don't have clean URL's enabled. But that shouldn't be an issue right? I mean I don't want cleanURLS enabled anyway. – KaushikTD Aug 26 '13 at 12:15
  • NO it is not an issue. Is the new site under ROOT/new folder? – TheodorosPloumis Aug 26 '13 at 12:17
  • Yes you are right. It's under ROOT/new – KaushikTD Aug 26 '13 at 12:20
  • I 've edited my answer. Did you find any solution? – TheodorosPloumis Aug 26 '13 at 21:25
-1

First of all mention $base_url = 'http://example.com'; in settings.php file. Then provide permission to your files folder. It should be at sites/default/files

Provide permissions:

cd /var/www/drupal_root/sites/default/
sudo chmod 777 -R files

Hope this helps

Your Answer

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

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