doutui9606 2009-07-01 17:40
浏览 7
已采纳

如何使静态URL指向不同的服务器?

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 http://www.domain.com/temp_content/filename.jpg which links to http://www.domain.com/file-ID

Except in 10 mins, http://www.domain.com/temp_content/filename.jpg wont exist, it will be http://server1.domain.com/thumbs/filename.jpg

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?

  • 写回答

10条回答 默认 最新

  • douli6605 2009-07-01 17:43
    关注

    You could use a mod_rewrite command in your .htaccess to check if the file in temp_content exists, and if it doesn't, have it redirect them to the new location.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(9条)

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)