Question

I'm upgrading to rails 3.1 and I need to have the /images directory be an alias to /assets. Is this possible? The reason being I don't want emails that I have sent out to clients which have direct links to files in /images to break.

Is this possible at the web server level? I'm on nginx.

Was it helpful?

Solution

You can do this in nginx

location /images {
    alias /usr/share/rails_app/public/assets/images;
}

Though I think the bigger problem will be when you run

rake assets:precompile

It will add a md5hash string to your images. This hash string is added to force browsers to download changed images, so it doesn't use the browser cache. Since the names of the images will be different. It might make more sense to host the old images in a static directory with nginx.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top