Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im building multi-server support for a file upload site Im running. When images are uploaded.... they are thumbnailed and stored on the main front-end server, until cron executes (every 10 mins) and moves them to storage servers, so for the first 10 mins, they will reside, and be served off the main front-end server.

When a file is uploaded, users are given embed codes... which is a thumbnail url + link to the full size, which is a html page. So it might be something like which links to

Except in 10 mins, wont exist, it will be

if the user grabbed the original code... the thumb file will be broken.

I COULD move the file to its destination, without cron, but that will take time, and will lag the script until the move is complete. I also dont like to have users running commands like that, I'd rather have the server do them at regular intervals.

Anything else I can do?

share|improve this question
up vote 10 down vote accepted

I would start by always abstracting the filename. It will save you a lot of hassle.

You could then hand out the second link ( as that's where the majority of requests will go and then handle edge cases where the file hasn't yet been moved with mod_rewrite. Eg:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(.*)$$1 [R=302]

That will 302 (temporarily) redirect requests to files that don't exist to the other domain.

Alternatively you could make storage from the first server available from the second.

share|improve this answer
+1: better than what I was typing! – tomjedrz Jul 1 '09 at 19:37

Could you change the message sent to users to include both URLs?

You could also make a custom error page that allowed users to enter the URL they were given and have it automatically translated.

share|improve this answer
use embeds the thumb into their site..... after 10 mins, thumb is a red X. – user11350 Jul 1 '09 at 21:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.