All the paths linking to modules, javascript, css are correct when I move a site locally and run in a vagrant environment. Yet, the image paths stored in the site come out wrong, so they are all borked.

The console in Chrome shows the paths to the images as skipping a folder. This is how the path looks: localhost/sites/default/files/img.jpg

This is how the path should look: localhost/sitename/sites/default/files/img.jpg

For some reason, Drupal in Vagrant looks for the sites folder in the localhost folder. I feel like something is wrong with the way apache is set up on my Vagrant installation. But I suppose it could be a number of things. Does anyone know?

2 Answers 2


you should add your site name to the base url in .htaccess file and uncomment the base url code.

  • I think you add the base URL to the settings.php file. But that didn't help, as it's a configuration with apache. Sep 9, 2015 at 22:31

So I think I figured out that the solution to my problem involves updating the apache configuration for each site I run locally. My hosting service does this for me on the prod, but you can update it locally. Probably system admin 101 stuff: http://www.techmalaya.com/2008/06/09/apache-22-virtual-hosting/

  • Linked resource returns 404
    – leymannx
    Aug 10, 2019 at 10:37

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.