For SEO purposes I need to rename around 150.000 images, then I'd like to permanently redirect the previous url locations requests to the new locations.

The current url to every image is something like:


And I want to redirect them to:


I can only think about 2 options:

1) Create an enormous list of redirects to include into my nginx's conf file.

2) Redirect those requests to something like "website.com/new_location/unique_id" that will redirect the request again to the new path.

There are other, better, options?

Should I avoid multiple 301 redirects?

Will crawlers downgrade my rankings because of multiple redirects?

  • 1
    Out of curiosity, how does SEO fit in to this?
    – Chris S
    Oct 28, 2013 at 17:14
  • You're right it's just a detail. Anyway now their names are just MD5 hashes, while Google suggests to provide descriptive file names instead. Oct 28, 2013 at 19:45

1 Answer 1


Keeping things to a single redirect is certainly the best. You can assume that you can get away with two, but three and up is asking for trouble.

I suggest a script that auto generates the needed nginx conf file. That will give you the best performance. (Otherwise, you will need to execute a php or other script for every request... This last approach is often done by adding wiring to the 404 script to see what was requested, and if it is on the list of "files to redirect" it does a 301 instead of a 404)"

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.