Dynamic Dns

Dynamic Dns
Dynamic Dns Dynamic Dns

How to Dynamically Create Sub Domains

Introduction
Have you even seen a website that immediatly assigns you a personal subdomain as soon as you sign up?  Sometimes it takes the form of: myusername.thewebsite.com or something like that.  This article will show to how to produce that effect so you can offer this feature to your users.

I used this particular feature to offer new groups on my website their own group subdomain. Groupbox is a website for online groups.  So if you went to Groupbox and created a new group, you could also choose a unique subdomain to quickly navigate to your newly created group. It would look something like mynewgroup.groupbox.com.


After reading this guide you will be able to:

Dynamically create subdomains and use them to send users to specific parts of your website.

What you will need:
I’ll need to assume you know a bit about programming on the web, the .NET framework, and in this case some VB.NET.

This guide references websites that are hosted on IIS. If you’re using something else then you can probably still just adapt most of the logic to suit your hosting.

You will probably need to make a change to your DNS zone file for your domain.  We’ll discuss this later.

You will need to use ISAPI_Rewrite (a 3rd party product) to implement this solution. The lite version is free and will suit your needs.  It is installed on the server and uses regular expressions to manipulate URLs. More about this later.

 

 

How we are going to do it (Summary)

To achieve the effect of dynamically creating subdomains what we need to:

 

 

- redirect all requests sent to the server with a subdomain to a specific page

- somehow let that page know which subdomain was used

- then redirect the user to the specific page their looking for

To do this, we’ll need to do 3 steps.

 

Step 1: Setup DNS

You will need to create a catchall or wildcard in your DNS zone file so that it will process any requests with a subdomin like they are normal web pages.  By adding the following refernce to your DNS you can achieve this:

                *.yourdomain.com. 14400 A  000.000.000.000

Where the IP address is your webserver IP.  Please note that many DNS are different and that you may not even have direct access to make changes to your zone files. Just contact your hosting company and explain you want to create the above effect and they should be able to do this for you.

 

Step 2: Configure IIS

You’ll need to let IIS know that you are now sending all sorts of requests for webpages with different domain name host headers.  If this sounds technical then don’t worry – it is easy.  Using IIS, open the properties for your website. Under the ‘Web Site’ tab click ‘Advanced’ next to the IP Address field.  Remove whatever is in the hostheaded field so that it only shows an IP address and a port.

It is possible that you don’t have access to IIS on the server your website is on. Contact your webhosting company and let them know what you want to do.  If they can’t do it because you’re in a shared hosting environment then you might want to consider upgrading to Virtual Private Server hosting which will give you this increased control.

 

Step 3: ISAPI Rewrite

Here comes the cool bit. Now that you have told your DNS to send any requests with any subdomain to your webserver (Step 1). And you’ve told your webserver IIS that any request with an unspecificed subdomain should just go to your primary website (Step 2), we can now interpret these requests and handle them appropriatly .

ISAPI Rewrite does exactly this. It allows you to intercept URL requests and manipulate them. What we will do is take the part in front of your domain, the subdomain part of the domain, and append it to a querystring that you can then interpret.

Here is an example of what I mean:

Incoming request: http://user1.groupbox.com

Rewrites to: http://www.groupbox.com/filter.aspx?username=user1

The expression you need to use for ISAPI Rewrite is as follows:

RewriteEngine On

 

RewriteCond %{HTTPS} (on)?

RewriteCond %{HTTP:Host} ^(?:www.)(.+)$ [NC]

RewriteCond %{REQUEST_URI} (.+)

RewriteRule .? http(?%1s)://%2%3 [R=301,L]

 

RewriteCond %{HTTP_Host} ([^.]+).groupbox.com$ [NC]

RewriteRule (.*) http://groupbox.com/filter.aspx$1?username =%1 [NC,L]

 

This may look meaningless to you but once you read a little bit about ISAPI Rewrite, you’ll quickly see where to put this code and you’ll be away.

Please take note that this will also remove the www from the front of all of your domain name requests. If you don’t want this to happen then only use the first line (to turn the engine on) and the last two lines.

 

Step 4: Handling the querystring

It should be obvious to you what to do now: you just need to create a page that will look at the querystring parameter and then send the user to anywhere you want, in this case it would lookup the username in your website database and send the user to their profile page. I haven’t been very detailed on this step because it will be different in every case but if you have problems then please contact me and I’ll help you.

Summary
This is quite a professional looking feature once you implement it. In some cases it may not be possible to do because of limitations on how much you can configure a shared hosting environment. Good luck.

Will Max D is a developer at Groupbox, a website for online groups http://groupbox.com

 

 

 

 

 

 

About the Author

Will Max D is a developer at Groupbox. Groupbox is a website for online groups. (http://groupbox.com)


 Dynamic Dns


Living In The Groove


$11.00


Original “Groove Rock” – a dynamic blend of rock/funk/R&B. Hot guitar & sax solos. Driving rhythm section. Soulful male & female vocals. Solid dance grooves. Music to cure what ails you!…

 Dynamic Dns


Comfortable


$7.50


Describing the music of midwestern songwriter/performer Kellie Lin Knott often leads listeners to interesting comparisions. Fans have suggested that her voice is a ‘cross between Alanis Morissette’s contraltro bravada and Billie Holiday’s subtle, sexy delivery’, that her harmonic, rhythmic and lyrical sensibilities are purely ‘Joni Mitchell’, and that her jazz-influenced, groove driven acoustic gu…

 Dynamic Dns


Wifi Wireless Ip Network Camera with Built-in DVR and Motion Detection Triggered Email Alarm and Wireless Connectivity


$229.00


On-camera recording to MicroSD card (not included) with playback and download via a web browser
Wireless connectivity (IEEE802.11b/g/n), with WEP, WPA and WPA2 encryption
Audio streaming with built-in microphone
Moonlight mode allows for brighter viewing in low light conditions
Live mobile streaming, with support for 3GPP protocol mobile devices including the iPhone that can view live footage w…

 Dynamic Dns


TP-Link WL TL-WR340G 54M 4PT Routr


$16.99


1 x Antenna – ISM Band – 54 Mbps Wireless Speed – 4 x Network Port – 1 x Broadband Port…

 Dynamic Dns


TP-Link TL-R860 Cable/DSL Router for Home and Small Office


$26.99


9 Ports…

 Dynamic Dns


LaCie 5 big Network v.2 10TB 2 x Gigabit Ethernet RAID Professional 5-Bay Network Attached Storage 301525U


$1,099.00


The LaCie 5big Network 2 offers professional, reliable, central storage for instantly storing, sharing, and backing up from any PC or Mac on your network. It provides up to 10TB of storage capacity in five bays, expandable with its two USB and two eSATA ports. You can also take advantage of its two Ethernet ports to do link aggregation and get twice the performance of single Gigabit Ethernet conne…

 Dynamic Dns


Foscam FI8910W Wireless/Wired Pan & Tilt IP/Network Camera with IR-Cut Filter for True Color Images – 8 Meter Night Vision and 3.6mm Lens (67° Viewing Angle) – White NEWEST MODEL


$99.99


From the Manufacturer:
The Foscam FI8910W features high quality video & audio, pan/tilt, remote internet viewing, motion detection, night-vision, embedded IR-Cut filter and built in network video recording system. In addition, it is smartphone compatible (Iphone, Android & BB) as well as viewable over the internet using standard web-browsers. The camera functions well as an Iphone baby monitor or …

 Dynamic Dns


Foscam FI8918W Wireless/Wired Pan & Tilt IP/Network Camera with 8 Meter Night Vision and 3.6mm Lens (67° Viewing Angle)


$79.50


The Foscam FI8918W Wireless IP Camera (White) offers features such as high-quality video and audio, pan/tilt, remote internet viewing, motion detection and night-vision. With 1/4″ color CMOS image sensor, it delivers clear images in MJPEG format at a resolution of 640 x 480. A minimum illumination of 0.5 lux makes the camera suitable for low-light surveillance. With 11 IR LEDs effective up to 26′ …

 Dynamic Dns


Turbulent Flows


$61.98


Turbulent Flows is an up-to-date and comprehensive graduate text on this important topic in fluid dynamics. The book consists of two parts: Part I provides a general introduction to turbulent flows, how they behave, how they can be described quantitatively, and their fundamental physical processes. Part II is concerned with different approaches for modeling, or simulating, turbulent flows. Key app…

 Dynamic Dns


LES, DNS and RANS for the analysis of high-speed turbulent reacting flows annual report submitted to NASA Langley Research Center : progress report … … 1994-July 31, 1995 (SuDoc NAS 1.26:199075)




Have A Question?

Are you looking for something but can not find it, or have a question for us? We would love to help you. Just fill out the form below and we will get back to you as soon as possible.

anti allergy bedding gifts for twins Zygors guide review www.ordercameras.com.au buy bio clean
Section 21 Notice dog training tips Moonshine Recipe Double Your Dating Review Beginner Violin