Forum Moderators: buckworks & webwork

Message Too Old, No Replies

something.domain.com

using non-www url's

         

fhuijgen

3:12 pm on Apr 16, 2003 (gmt 0)

10+ Year Member



Hello,

I'm interested in using a domain that is non preceeded by www, mainly for marketing reasons. I notice that if I type anything in front of my domain, like 'thisisatest.domain.com' I will connect to www.domain.com

But what do I need to do to create a different page under thisisatest.domain.com?

IanTurner

3:30 pm on Apr 16, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You will need to create a seperate A record in your DNS record for the domain pointing to the server for the thisisatest.example.com site.

dmorison

3:31 pm on Apr 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

It looks like the hard part is already working - that is that the DNS for your domain is already pointing [anything].yourdomain.com to the same IP address.

So now you need to learn about "Virtual Hosts", that is, where your web server serves up a different site based on the host name that was used to get to the server.

If you're using Apache, and have access to your config files etc., then start here:

[httpd.apache.org...]

If not, then you'll have to speak with your web hosting provider about setting up virtual hosts for you, as it will require some configuration on your web server.

Hope this helps!

dmorison

3:33 pm on Apr 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ian -

DNS configuration shouldn't be necessary as it sounds from the original posters comment that wildcard DNS is already configured - i.e [anything].hisdomain.com will hit his IP address...

IanTurner

3:54 pm on Apr 16, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



That depends whether he is going to be using a different server for the test subdomain. I would also think that it is good practice to specifically specify any tertiary domains that you are actually going to use.

fhuijgen

4:00 pm on Apr 16, 2003 (gmt 0)

10+ Year Member



That is correct, [anything].mydomain.com will hit my domain. But we don't run our own webserver and dont host our domain, so this must be configured that way by my service provider.

I understand how virtual hosting could offer the technical possibility, but that would have to be done by our service provider and I dont see that happening.

So, I guess I'm out of options? (an example of what I want is : m2m.opto22.com that gives a different site than www.opto22.com?

Thank you very much for your help dmorison

dmorison

6:15 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

All is not totally lost, you could make something work using JavaScript.

For example, put this as index.html in the root directory of your website, and build the individual websites in subdirectories such /foo and /bar

<html>

<body>

<script type='text/javascript'>

var test = new String(window.location);

if (test.indexOf("foo") > -1)
{
window.location = "http://foo.yourdomain.com/foo";
}
if (test.indexOf("bar") > -1)
{
window.location = "http://bar.yourdomain.com/bar";
}

</script>

<!-- and for those without JavaScript enabled -->

<a href='/foo'>Click here for foo</a>

<br>

<a href='/bar'>Click here for bar</a>

</body>

</html>

You could achieve the same effect (and not worry about JavaScript compatibility) using some server side scripting language.

Cheers.

dmorison

6:30 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just to add -

If you use something like the above, consider how your site would appear to search engines.

There is the possibility that a page from /foo could turn up in the search results under the "bar" sub domain, for example as:

[bar.yourdomain.com...]

Not sure what you could do about that.....?

dmorison

6:42 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nope, we're ok...

as long as your non javascript links contain the full host name and not just the sub-directory, a la:

<!-- and for those without JavaScript enabled -->

<a href='http://foo.yourdomain.com/foo'>Click here for foo</a>

<br>

<a href='http://bar.yourdomain.com/bar'>Click here for bar</a>

Phew... :)

IanTurner

8:28 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



dmorison, that is a really nice workaround. I'm impressed.

(I do have reservations about javascript redirects and SE placements, but that is another topic)

dmorison

10:46 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



:) Thanks.

I'd go along with your earlier comment about giving specific A (address) records to the tertiary domains he wishes to use; it's not impossible that his DNS provider might one day turn off wildcard matching without letting anyone know...

TallTroll

10:59 am on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The domain record you should be concerned with here is CNAME (short for Canonical NAME).

By default, the A record specifies the IP for domain.com. Any address like www.domain.com needs a CNAME record to direct the browser correctly (most servers have www setup to point to the root by default, but it doesn't have to be so).

The question is whether your host will allow you to specify new CNAME records for specific 3rd level domains or not. I know of 1 domain for certain where the various whatever.domain.com bits are spread across 4 servers. We can do this because we have access to the root domain record

Reynard

5:23 pm on Apr 18, 2003 (gmt 0)

10+ Year Member



fhuijgen -

If this is an issue in the future you may want to consider switching hosts.

Without giving names, the host I use has a nice control panel setting called 'Virtual Hosts' that pretty much walks you through the process. I can set up as many as I like, I am only limited by the amount of HD space I take up on the server.