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?
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!
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
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.
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.....?
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... :)
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
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.