?
Solved

How to create/use a virtual subdomain

Posted on 2004-03-22
4
Medium Priority
?
934 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 1000 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 1000 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 1000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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‚Ķ
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

752 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