Solved

How to create/use a virtual subdomain

Posted on 2004-03-22
4
925 Views
Last Modified: 2007-12-19
Hi, I am new to PHP. In fact I have managed to avoid using it at all.
I would like to know how to do something like what these guys have done here:
http://santa.clause.swellserver.com/news/top_stories/auto80.php
The sub domains can be changed to anything at all, and the page picks them up.

The reason I would like to know this is that my host charges me for every new subdomain I want to create.

I would like to be able to use this method which is more of a "virtual" subdomain.

The only thing is I would still like to be using ASP coding on the same page, but even still, if you can answer the original question of "how it is done" you can share the points.
0
Comment
Question by:m8rix
  • 2
4 Comments
 

Accepted Solution

by:
Pentabyte earned 250 total points
ID: 10655776
> The reason I would like to know this is that my host charges me for every new subdomain I
> want to create.

Then you need to change your Webhoster!
They only charge money, because they spend working time for typing in your subdomains. They just don't allow you access to their interface.

Solution A)
Pay for ONE wildcard subdomain: *.yourdomain.com
... and every request will be forwarded to your html-directory

Solution B)
Choose a webhoster with some kind of domain-management via webinterface.
My webhoster provides me with Confixx, a tool to configure email-adresses, pop-accounts, subdomains, mysql-databases, etc.
0
 
LVL 7

Assisted Solution

by:Saoi
Saoi earned 250 total points
ID: 10656949
You might want to consider transferring control of your domain to ZoneEdit (http://www.zoneedit.com/). Its free, it allows unlimited sub-domains, redirections to each domain, MX records - basically full control over your domain. You can pay for some extra services, but its not really necessary. I use ZoneEdit to look after my companies domains, we have never had a problem with them in 3 years.

Depending on your host configuration you may have to negotiate with them about how the server handles requests - ie if the host name is used to redirect to a virtual server (most likely) rather than having a specific IP for your server, they may not like it. But there are ways around that also.

Hope this helps
0
 
LVL 10

Author Comment

by:m8rix
ID: 10661825
Thank-you to both Pentabyte and Saoi for your comments and sugestions. I am asking my host if it is possible to pay for ONE wildcard subdomain: *.yourdomain.com and suggested by Pentabyte.

I can't afford to change hosts at this stage because of the down time in between. I would have to talk to my clients and let them know what I am doing first. Besides I have been using my host for some time, and until now they have been pretty good.

But getting back to the topic. Does anyone know how the virtual subdomain in the following link is captured?
http://any.subdomain.swellserver.com/news/top_stories/auto80.php
http://change.here.swellserver.com/news/top_stories/auto80.php
http://differentsubdomain.swellserver.com/news/top_stories/auto80.php

change the subdomains as you please to see what I mean.
0
 
LVL 7

Assisted Solution

by:Saoi
Saoi earned 250 total points
ID: 10665781
I assume they are simply parsing the URL with a regular expression.

A very simple and unchecked parse...
<?
//Capture the server address:
$server_address = $_SERVER['HTTP_HOST'];
// remove the rest of the domain
$sub_domain = str_replace(".swellserver.com", "", $server_address);
// Sub domain would be:
// "any" or
// "change.here" or
// "differentsubdomain"
// depending on which one you are.
?>
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Google Maps API and PHP 25 34
PHP not parsing ' character 12 40
error while installing php56 in redhat enterprise linux 20 25
parse url to form? 7 14
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question