Forum Moderators: buckworks & webwork

Message Too Old, No Replies

one IP, multiple domains - bypass setup fees?

Can I by-pass virtual domain fees if I use this script?

         

sun818

7:11 pm on Sep 18, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If I want to use all my domains on a static IP, can I use one of these scripts? The benefit would be not having to pay setup fees or monthly fees to the webhost. Will this work on all web browsers? Do web hosts allow this? For PageRanking and crawlability, is it better to point to a root index file instead of a directory?

PERL

if( $ENV{"SERVER_NAME"} =~ /domain\.com$/i ) {
print "HTTP/1.1 302\r\nLocation: /usr/account\r\n";
}
else {
print "Content-type:text/html\n\n";
print "You came to unknown domain. Please choose one of the following:<br>";
print "<a href='http://www.domain.com'>http://www.domain.com</a><br>";
}

ASP

This is an example of

default.asp
that will redirect the requests for different domains to appropriate directories.

<%
If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("domain1.com") ) > 0 Then
Response.Redirect("/directory1")
ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("domain2.com") ) > 0 Then
Response.Redirect("/directory2")
ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("domain3.com") ) > 0 Then
Response.Redirect("/directory3")
Else
Response.Write("You came to an unknown domain.")
End If
%>

Notes:

  • Replace "domainX.com" with the actual domain names.
  • Replace "/directoryX" with the actual names of the sub-directories of your
    /Htdocs directory.
  • There is no need to replace "SERVER_NAME" with the name of the primary
    domain of the website. SERVER_NAME is a meta variable.
  • You can use specific file names instead of directory name in "/directoryX".

    COLDFUSION

    This is an example of

    default.cfm
    that will redirect the requests for different domains to appropriate directories.

    <CFIF FindNoCase("domain1.com","#CGI.SERVER_NAME#") GT 0>
    <CFLOCATION URL="/directory1">
    <CFELSEIF FindNoCase("domain2.com","#CGI.SERVER_NAME#") GT 0>
    <CFLOCATION URL="/directory2">
    <CFELSEIF FindNoCase("domain3.com","#CGI.SERVER_NAME#") GT 0>
    <CFLOCATION URL="/directory3">
    <CFELSE>
    You came to unknown domain.
    </CFIF>

    Notes:

  • Replace "domainX.com" with the actual domain names.
  • Replace "/directoryX" with the actual names of the sub-directories of your /Htdocs directory.
  • There is no need to replace "SERVER_NAME" with the name of the primary domain of the website. SERVER_NAME is a meta variable.
  • You can use specific file names instead of directory name in "/directoryX".
  • Air

    6:04 am on Sep 20, 2002 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    That is a way to setup subdomains, but it won't work for individual domains. i.e. if you have a domain example.com then you could also have mysite.example.com, mysite1.example.com, etc. and they would properly resolve to your IP address (assuming the web host had allowed a DNS wild card entry for your domain). The script would then match the "mysite" part of the domain and redirect it to the appropriate root path for the content to serve.

    But.... it would not work for example.com, and example1.com, unless you could talk your web host into adding DNS entries for all your domains and map them all to your one IP address.

    IMO you are asking for trouble in using your domains in this way.

    Crazy_Fool

    1:31 pm on Sep 20, 2002 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    you want to host lots of sites without paying for them? servers have to be paid for and web hosts rely on site owners to pay them for hosting. if you don't pay, who will? how will the web host keep his servers online if people cheat to get free hosting?

    if you get caught breaking the hosts terms and conditions and cheating them out of money, at best you'll get poor service (slow or no support) and at worst you could get shut down without notice or explanation. terminations can be extremely costly in terms of lost business. you could theoretically also find yourself on the receiving end of a claim for non-payment (although i don't actually know of any such cases).

    if i catch someone cheating me, i normally wait until googlebot comes around then terminate. the couple of days it takes them to find out what's happened then get the site back online with another host is normally long enough to destroy their listings in google for a month. i know a number of other web hosts that also play the "you screw us and we'll screw you" game and the beauty of it is that site owners simply cannot prove a thing or do anything about it.

    don't be surprised as well to find that if you get shut down for defrauding a web host, that whoever you move the site to will "discover" why you were shut down and they may refuse to host your site. at the very least they could be watching and waiting.

    hosting is very cheap - 12 months hosting costs less than a good night out. there's no real excuse for defrauding web hosts. you play the game and pay the hosts, and they'll play the game and give you the service and support you need.

    look for hosts that allow multiple sites on one account. these are normally known as reseller accounts or multi-site accounts. pay the fees, stay legal, and you can't go wrong.

    sun818

    5:55 pm on Sep 20, 2002 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



    Air - Can you go into detail about the "troubles" I might face with setting up domains this way?

    Crazy_Fool - If I pay for web hosting service that is under utilized it is reasonable to maximize the allowed bandwidth by directing more traffic to the web host. Only 1Gb out of 5Gb is being utilized. Why not point three or four domains to it? As Air said, it is not possible to set it up the way I described anyway. My web host wants $20 to point a domain to the IP. Who is cheating whom?

    Crazy_Fool

    9:39 pm on Sep 20, 2002 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    >>Only 1Gb out of 5Gb is being utilized. Why not point three or four
    >>domains to it?

    how about that $20 thats sitting in your bank account doing nothing? that's under utilized. would you likewise agree to someone helping themselves to that?

    >>My web host wants $20 to point a domain to the IP. Who is cheating
    >>whom?

    if you don't like it, find another host. don't defraud a host just because you disagree with their pricing structure. there are thousands of hosts out there that will allow what you need at prices you can afford.

    Air

    3:54 pm on Sep 21, 2002 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    >Air - Can you go into detail about the "troubles" I might face with setting up domains this way?

    There's a few. The fact that all requests to all domains will be handled by one script will cause a performance problem for your sites' response times. Most machines are set to limit a single process (or the same process many times) from monopolizing the machine. Your script would fall into this category.

    The way the content is pointed to is by redirecting the request, this sets a redirection code that can trigger specific actions to a search engine spider, some browsers, and your logs will be a mess.

    If you decide to run certain scripts on those domains you may find that they will not work. Since a script is already handling all page requests this may be unforseen to the script you want to use, consequently you may find configuration difficult, and operation faulty.

    Then there's the stuff Crazy_Fool mentions, which distilled, is that hosts will target you for special attention if you use too much resources. It may not sound right, but most hosts offer hosting plans with space and bandwidth limits that are set to be competitive, but they know that very few will come anywhere close to those limits. If you do, expect to be asked to move to a higher priced plan or to a new host.