Solved

How to create/use a virtual subdomain

Posted on 2004-03-22
4
932 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 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