httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Andersson" <rob...@profundis.nu>
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 *.domain.com -> domain.com. 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 www.domain.com *.domain.com). 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('.domain.com');
        if(subDomain != -1)
            location = 'www.domain.com/' +
                 location.href.substr(7, subDomainLength - 7);
    }
</SCRIPT>

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 http://domain.com, 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.

Regards,
Robert Andersson




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message