thank you my friend
and this is my solution:
------------------------
the code redirects
http://A/files/b.exe to
http://B/files/b.exe if b.exe
is not in server A
type this code in your htaccess file :
ErrorDocument 404
"<html><body>
<script language =javascript>
url= window.location;<!--current URL
url = url+'';<!--convert it's type to string
slash_location=0;
<!--this while is using for extracting the file name
<!--i mean :
http://A/files/b.exe that isn't in server A
while(slash_location!=-1)
{
end_slash_location= url.search('/');
url=url.substring(end_slash_location+1,url.length);
slash_location=url.search('/');
}
<!--here value of URL is b.exe
window.location='http://B/files/'+url; <!--redirect it to server B
</script>
</body></html>"
Note:
1.ErrorDocument 404 command:
ErrorDocument 404 is a event that arise when "Page can't be displayed"
and then the command is executed.
2.all of the mentioned code must be in one line.
3.ErrorDocument 404 " you can't use double quotation in this area ".
4.the script must locate just in one of the servers(in this case in server A).