.htaccess文件重定向,如果不存在,远程文件上传 [英] .htaccess file redirect if not exists, remote file upload

查看:97
本文介绍了.htaccess文件重定向,如果不存在,远程文件上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

服务器A - 应用程序

Server A - application

服务器B - 从上传静态的媒体,没有应用

Server B - static media from uploads, no app

应用程序服务器A处理上传,验证和岗位作业来转换,转换后它通过复制(安装驱动器)移动到服务器B。然后该媒体文件经由服务器A上一个玩家在网页加载

App on Server A processes the upload, validates and posts a job to convert it, after the conversion it's moved to Server B via copy (mounted drive) . Then the media file is loaded via a player on the page on Server A.

我想通过远程URL HTTP来加载文件://serverB/files/file1234.wtf 如果文件仍然是现在还没有(尚未复制),透明地重定向到的http:// serverA的/ tmp_files / file1234.wtf

I want to load the file via the remote url http://serverB/files/file1234.wtf and if the file is still not there yet (not yet copied), to transparently redirect it to http://serverA/tmp_files/file1234.wtf

如何使用htaccess的或任何其他的方式做到这一点?

How to do it with htaccess or any other way?

推荐答案

假设的Apache + mod_rewrite的,这应该工作在你的的.htaccess 上SERVERB:

Assuming Apache + mod_rewrite, this should work in your .htaccess on serverB:

RewriteEngine on

RewriteCond %{DOCUMENT_ROOT}/files/%{SCRIPT_FILENAME} !-f
RewriteRule ^/files/(.*)$ http://serverA/tmp_files/$1 [L,R=temporary]

这篇关于.htaccess文件重定向,如果不存在,远程文件上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆