mmiscool
Full Member
 
Send me a message if you want to help with a WEB OS project
Posts: 106
|
Post by mmiscool on Aug 3, 2014 13:06:41 GMT -5
Hello,
I have several domains that point to the same ip address.
Is there a way to make it so that I can see what domain name they are using?
Any help would be appreciated.
|
|
neal
Full Member
 
Posts: 104
|
Post by neal on Aug 3, 2014 20:38:41 GMT -5
The only way I know is to use something like an Apache redirect (or equivalent if using a different webserver) to add the hostname as a URL parameter:
eg.
<VirtualHost *:80> ServerName myserver.com Redirect http://realserver.com:8008/seaside/go/runbasicpersonal?app=someApp&domain=myserver.com </VirtualHost>
<VirtualHost *:80> ServerName otherserver.com Redirect http://realserver.com:8008/seaside/go/runbasicpersonal?app=someApp&domain=otherserver.com </VirtualHost>
Then you can get the domain from UrlKeys$.
I use a combination of Apache redirects and proxies which serves multiple Run BASIC sites on port 80 from my home server. (A good alternative to Apache is Pound - it's purely a proxy and a bit easier to set up provided you have a Linux machine to run it on).
|
|
|
Post by kokenge on Aug 6, 2014 7:27:22 GMT -5
I do this all the time. I have several domains going to the same IP.
I simply look at the domain coming in and direct it to the proper directory. I display a forwarding message and a title. However unless your server is very busy the message is never displayed long enough for anyone to see it.
This html checks for domain1 and redirects it to the /doamin1 directory. If it's not domain1 it goes to my catch all default /domain2 directory. You can add code to check for as many domains as you like. I'm using the Apache server with a www directory under wamp. So it gets sent to wamp/www/domain1 and runs that index.html
<HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1"> <script type="text/javascript"> function urlforward(){ var wl = window.location; var lh = (location.host); var lp = (location.pathname); var lr = (location.href); if (lh == 'www.domain1.com' || lh == 'domain1.com' || lh == 'domain1' || lh == 'www.domain1') { window.location = window.location.protocol + "//" + window.location.host + "/domain1"; } else { window.location = window.location.protocol + "//" + window.location.host + "/domain2"; }; } </script> <TITLE>Any Title</TITLE> </HEAD> <BODY onLoad="urlforward()"> Redirecting.... </BODY> </HTML>
Hope this helps.
|
|