HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank

Reply to topic Page 1 of 1
two servers for one upload center
Message  

Reply with quote
Post two servers for one upload center 
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.

View user's profile Send private message

Reply with quote
Post Re: two servers for one upload center 
Hi

use this in your .htaccess

---------Start----------
# to make exe force to download
AddType application/octet-stream .exe

#redirect your request to paticular server
Redirect 301 /files/a.exe http://Washingtonserver-path/a.exe
Redirect 301 /files/b.exe http://NeWYorkserver-path/b.exe
-----------End---------

place the .htaccess file your both server


_________________
Thanks,
Muthukumar Selvarasu,
Project Manager,
Webmasters Ltd.
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger

Reply with quote
Post  
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?[COLOR="Red"]r_u=requested_url[/COLOR]"

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?[COLOR="Red"]r_u=requested_url[/COLOR]"
is there any variable?

i don't know the name of the files.
please send the complete code.

View user's profile Send private message

Reply with quote
Post  
hi
thank mehdi :d

for this question cant use dynamic programming like php

only use htaccess or server

i use this code in htaccess to redirect with all request url
Code:

ewriteEngine On
RewriteRule upload/(.*)$ http://server2.com/upload/$1 [L]

but i think we can use this code when 404 error return
ErrorDocument 404

View user's profile Send private message Yahoo Messenger

Reply with quote
Post  
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).

View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  




FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Web Hosting
Web Hosting and Dedicated Servers Advertise Here $10 a Month Designer Children
Insurance HGH Domain name registration
Affordable web-hosting Dedicated Server Management

Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com