000webhost.com – Subdomain not working
You registered your domain, signed up for a free 000webhost.com account, activated your account and am now trying to setup a subdomain for your blog like for example blog.yourdomain.com. Setting up the subdomain is a piece of cake really, all you need to do is to login to your 000webhost.com control panel, then click the Subdomains link and enter a name for your subdomain. The 000webhost.com servers will do the rest and create the necessary entires and directory on the server.
If you wonder about the directory for the subdomain i mentioned…well, the actual subdomain is nothing but a directory inside your root folder (in case of 000webhost.com your root is /home/userid/public_html/). As i said, adding a subdomain is a piece of cake. Things might go south if you are not using 000webhost.com name servers ns01.000webhost.com and ns02.000webhost.com but use your domain registrars servers for whatever reason (i wouldn’t know of a single one really, i always use my hosts name servers as this makes things a lot easier to maintain/manage).
If you use your hosts name serves all is good and the subdomain will start working almost immediately after you created it. If you are not using your hosts name servers then the subdomain will be created, but when trying to access it you will see a 404 error message. The reason why you see the 404 is quite obvious…since 000webhost.com does not mange your DNS records the webserver is pretty much clueless about where to look for the subdomain, doesn’t find any record/pointer for it and returns the 404 error. No record for it has been created by the 000webhost.com servers since they don’t manage your DNS records. And no records in this case results in the 404.
[su_note note_color=”#cdd3e7″]What to do when wanting a subdomain but not using 000webhost.com name servers?[/su_note]
Well, what you need to do is to create a record for your subdomain at your domain registrar. Almost all of them let you configure records in the domain management area. For the example i am going to show i am using Namecheap.com. They let you set all records when using Namecheap.com as DNS provider and this is what their management console looks like:
To make the subdomain work you now need to add a custom A record for the name of the subdomain. Let’s use habschned-travels.com as domain and say i wanted to add a subdomain “blog” to it, not using 000webhost.com name servers. This is what i would need to do to make it work:
[su_list icon=”icon: chevron-right”]
- Login to the Namecheap.com Domain Management
- Create an A Record with Blog as Hostname
- Put the IP the A Record needs to point to (IP can be found in your 000webhost.com control panel
- Save the changes
- Wait for changes to propagate
And that’s it. As soon as the changes to your DNS records have propagated your subdomain will start working. However, i suggest to use the 000webhost.com name servers instead. There are very few scenarios where you absolutely would have to use your domain registrars name servers, but i doubt that anyone using a free hosting service would ever run into those scenarios.