0

On my local dev environment, my images are stored in (relative to server root) /sites/default/files/images/

On the server, acquia cloud implements a virtual directory and the end result is that images are stored relative to root in /files/images

In my content nodes, I'm using root-relative paths for my images. But this means any time I migrate my content between the local environment and the server, all images break.

I don't want to have to take any manual steps to change image paths every time I migrate content (I migrate content "down" from server to lcal periodically so that I am developing against "real" content).

Shouldn't there be some simpler way to configure things so that the root-relative image paths can intelligently choose the correct path based on which environment is being accessed?

  • How exactly you embed images in content? And no, usually content is just a piece of, well, content, and cannot change easily. There are ways, of course (look for filters), but people I know would simply link folders to obtain identically - looking folder structure between dev, staging and production. Why won't you do this? Last, but most important: don't ask us what should be, ask us specific, non-speculative question. – Mołot Sep 7 '14 at 19:40
2

Implement a directory redirect on your local environment's web server so that any request for /files/* gets redirected to /sites/default/files/*

For example in Apache, edit the httpd-vhosts.conf

<VirtualHost *>
  ServerName yourservername
  DocumentRoot "pathtoyourdocroot"
  Redirect /files /sites/default/files
</VirtualHost>

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.