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

6
  • Can you provide your code how you are saving image? Commented Aug 26, 2013 at 12:09
  • I didn't manually write the code for saving the images. Images are saved directly by Drupal.
    – KaushikTD
    Commented Aug 26, 2013 at 12:16
  • Whether or not this solves the problem, you can change the $base_url in sites/default/settings.php
    – Geoff
    Commented May 10, 2014 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
    – user33576
    Commented Aug 22, 2014 at 4:59
  • Are you sure you copied the .htaccess file as well? Commented Jan 15, 2017 at 3:09

2 Answers 2

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.

4
  • 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
    Commented Aug 26, 2013 at 12:15
  • NO it is not an issue. Is the new site under ROOT/new folder? Commented Aug 26, 2013 at 12:17
  • Yes you are right. It's under ROOT/new
    – KaushikTD
    Commented Aug 26, 2013 at 12:20
  • I 've edited my answer. Did you find any solution? Commented Aug 26, 2013 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 and acknowledge you have read our privacy policy.

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