Introduction: Setting Up Subdomains on HTTP Alternate Ports (8080)
Step 1: Network Configuration
The reason for my special web server port was due to another web server running in my local network which has already occupied the port 80 and I have no access to that server. Hence, to host my website on another server (or PC), I have to use a different port (Port 8080).
Step 2: Domain Setup
First, you have to buy your domain name. The one I am using is provided by no-ip.com. In the Host Setting, you can choose "Port 80 Redirect". This will make the domain name you type in (e.g. example.com) be directed to your real ip address(e.g. 123.456.789.10:8080) with the use of
Step 3: Check the Result of Port Redirect After Your Setting Has Been Applied
After 5 - 10 minute, your setting should be updated and the iframe div should be added to your web page when you enter your domain name in your browser URL bar as shown in the picture.
Step 4: Create Files and Folders in Your "www" Folder
As I was using WAMP Server as my web server, my web server's root folder was in C:/wamp/www. You can read more on "how to install wamp" on the following instructable. Here
- Create a folder for your sub domain.If you want to use download.example.com, just create a folder call "download" inside your root folder.
- Create an index.php or rename your index.html to index.php if you already have your own index.
Step 5: Edit the Subdomains.php
- Check if the url in your browser URL bar contains .example.com
- If yes, get the part of string between the "http://" and ".example.com"
- Redirect you to the new url: "http://example.com/(subdomain)"
On line 20 and 21 of the zipped subdomain.php, you can choose either keeping the URL in your browser URL bar unchanged (test.example.com) or update the URL in your browser URL bar to "example.com/test/"
Open your index with wordpad++ or other text editor.
Add <?php include "subdomains.php"; ?> after <head> as shown in the picture.
Step 7: Done
video.example.com -> example.com:8080/video/
test.example.com -> example.com:8080/test/
Step 8: IMUS Laboratory
This system was a by-product of the development of IMUS Online System.
No update or improvement will be made to this code as the development of sub domains redirection system was terminated by our laboratory. Use with your own risk.
Free to share and modify. If you have any question, feel free to comment below and I will reply as soon as I read your comment.