Hi every one there is a upload center that it's files are divided between two servers. one of the servers is located in Washington and other one is located in New York. so some files will be downloaded from Washington server and other files will be downloaded from New York server. and i want to use one domain for both of them. for example : www.mehdiali/files/a.exe (it is downloaded from Washington server) www.mehdiali/files/b.exe (it is downloaded from New York server) what is your idea about using .htaccess(it is a file that locates in folder in apache and you can write some commands and according the commands apache do something) or is there any tools in operating systems that if there isn't requseted file in one of them send a message(request) to another operating system and get it. thank you in advance.
Your best bet will be asking in relevant OS forums about setting up network shares on server B so server A can setup aliases & treat those server B shares like directories. Then you can either setup a download script that checks the current location followed by the remote location for each request, or setup a 404 script that checks the remote location only in the event the current location doesn't have the file.
when we use 404 script , it redirect www.mehdiali/files/b.exe to another server without files/b.exe so b.exe will not download.
thank you for your replies, the solution : the user type mehdiali/files/b.exe(requested_url) that isn't available in server A. so i must redirect it to server B. i write a command like this in htaccess file : ErrorDocument 404 "http://localhost/divider.php?r_u=requested_url" so in divider.php page i have $HTTP_GET_VARS['r_u'] and after fetching the b.exe(file name) i'll redirect it to server B, like this : header("location:mehdiali2/filename/b.exe"); but my problem is how i can find requested_url. what do you write instead of requested_url in ErrorDocument 404 "http://localhost/divider.php?r_u=requested_url" is there any variable? i don't know the name of the files. please send the complete code.
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).
Have you considered having all files on both servers (mirrored) and using a re-director to send the web client to whichever server is available to serve the file at the time? (load-balance)