httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Andersson" <>
Subject Re: Subdomain In apache ?
Date Thu, 20 Jun 2002 06:29:59 GMT
Prachait Saxena wrote:

> So will u like to say that I would now to make any addition in the DNS
> setting for the subdomain ?

I don't know what DNS server you have, but you should be able to add
wild-card entries there as well. I'm not very good with DNS's but I have my
CNAME records for my hosts like * -> I use SimpleDNS
Plus, where it's really easy to do.

> Well I will do this
> >
> > You can use a wild-card in the ServerAlias directive in a vhost, so you
> > catch all subdomains (ie. ServerAlias * You
> > can
> > then dynamicly redirect to a sub folder by checking the server name.
> Soon and let you know

Do try it. What I meant by "dynamicly redirect" would be for example:

<SCRIPT ...>
    if(location.href.indexOf('http://www.') != 0) {
        var subDomainLength = location.href.indexOf('');
        if(subDomain != -1)
            location = '' +
                 location.href.substr(7, subDomainLength - 7);

This would be executed unless it is from the top domain. It will extract the
sub domain, and append it as a folder to the standard domain name. You'll
need to tweak it to allow people to just enter, and you
could add stuff so it also appends the specified subfolder etc. Also, I
haven't tested the script so there might be typos etc.

Not a very elegant solution, and I'm not sure what you will use it to. If
you explain the practical purspose with it, I might be able to suggest a
better solution.

Robert Andersson

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message