Tuesday, 8 January 2013

How to link sub-domains of your blog URL to externally hosted code


So, i had to set up a subdomain for my demo links to javascript/jquery plugins.
My blog Url is - "http://codehandling.com". My demo links pointed to a link like "http://codehandling.comoj.com/demoUrl.html" Now I want my demo Url to point to something like "http://demos.codehandling.com/demoUrl.html"




Here's how I did it:

1. Add CNAME records at your Domain account

Log in to your domain account at goDaddy.com or wherever you purchased your domain. Open your DNS Manager and click on Add Record button.



Select your record type as "CNAME(Alias)". The Alias name would be your subdomain prefix ie "demos" in my case. Then enter the host name where you want your subdomain to point ... in my case "codehandling.comoj.com". Click Ok.



You can also add another CNAME record with the alias name "www.demos" having the same host name.

2. Park your new subdomain upon your old link

Log in to your code hosting account that should show the pages at your subdomain. In my case, I log in my "000webhost" account where the code is hosted for the link "codehandling.comoj.com"
Navigate to the "Parked domains" section. Enter your subdomain Url here to park it on the old link and click the Park button.



Dats it!
So now when a user hits "http://demos.codehandling.com" OR "http://www.demos.codehandling.com", the page at "http://codehandling.comoj.com" will be shown to him.

1 comment: