Web Hosting Talk







View Full Version : sub-domains


KapTin Kirk
12-13-2000, 06:01 PM
Is there a way, through the use of Perl, PHP, .htaccess or whatever, to create sub-domains that are not simply redirects.

So for example, something.mysite.com would have URL's such as something.mysite.com/page/index.html instead of having something.mysite.com redirect to mysite.com/something and then having the URL as mysite.com/something/page/index.html

Hopefully I explained that alright without confusion :)

BC
12-13-2000, 06:14 PM
Welcome aboard :)

Yes, there are subdomain scripts written in either Perl or PHP - check out http://www.hotscripts.com for some of them.

Make sure your host has 'wildcard DNS' enabled for this feature to work. Most Alabanza hosts do not have this feature, but most VDI hosts already have subdomains enabled.

KapTin Kirk
12-13-2000, 10:11 PM
thanks :)

essentially I wanted to be able to create sub-domains that were not redirections (or at least, the url doesn't change) but acted like real sub-domains.

Anyway, yes my host has wildcards and I would like to be able to have URL's such as sub.domain.com/dir/file.html or sub.domain.com/dir2/dir453/file.html etc. instead of sub.domain.com redirecting to domain.com/sub

Is that at all possible through wildcards, or do I need a host that supports actual sub-domains. Thanks again

DaveC#
12-14-2000, 12:35 PM
Do it like this:

Create virtual host subdomain.mydomain.com with a document root pointing to the dir you want the pages to be called from then in your zone file add

subdomain IN A youripaddress

Félix C.Courtemanche
12-15-2000, 03:23 AM
If your host has the mod_proxy module installed in his apache distribution, you can transparently forward any request to a specific *real virtual* sub domain to any files / directory on your server.

To your visitors, it will appear that they are viewing a sub domain, but to the server it will be serving the files as if they were called the correct way.

All of this can be done from a little .htaccess file in your root web directory.

I don't have the specific code with me right now, but if you need to, I can easily find it out for you and give you an example.

KapTin Kirk
12-15-2000, 04:15 PM
I'm going to be moving from smarthosting to HostWay in the next month. Hostway says that they offer third level domains, but not sub-domain to directory pointers or sub-domains. Would it still work with them? I've already been confused to high hell with "third level domains"... isn't it the same as sub-domains?

megmaster
12-18-2000, 06:29 PM
Apache's mod_rewrite directive allows you a LOT of options and freedom in this area, IF your hosting company allows it. You'll need to have wildcard domains enabled in your .hosts file and then setup the proper mod_rewrite directives to rewrite the domain.

mod_rewrite allows the web server to serve files from different locations than the URL would indicate without changing the displayed URL. This is just one of it's feature. We use it here to block the offsite linking of files greater than 15k. This helps prevent bandwidth theft.