Using a Custom Domain with GitHub Pages
Update [05/13/2014]: Using this method may cause slow load times
As you may have noticed, as of last week this site uses a custom domain, but the content is being stored by GitHub. I seem to be playing around with my domains and where they point to a lot and I also always forget how to configure my domain when I actually need to change it. This post is for both you and my future self.
Resources You’ve Probably Already Found
This post is going to demonstrate how I got michaeljdeeb.com and www.michaeljdeeb.com to point to my personal GitHub Pages site and also the required settings to forward michaeldeeb.com to my new site as well.
On the GitHub Pages Side
You’re going to want to create a file named CNAME
at the root of the project and inside that file you’re going to put your bare domain. In my case it was michaeljdeeb.com
not http://michaeljdeeb.com
On the Domain Side
As a personal sidenote, I use Hover (referral link) for my domains.
Relevant for Hover users: How to: Edit DNS records - A, CNAME, MX, TXT, and SRV : Hover Help Center
michaeljdeeb.com (@)
First, delete any A, AAAA, or CNAME records that use @
for the hostname. Then, create two A records. The hostname for both of them is @
which refers to your top-level (apex) domain. The values at the time of writing are 192.30.252.153
and 192.30.252.154
, but I’d check the ”My custom domain isn’t working | GitHub Help” page to verify that the IP addresses haven’t changed.
www.michaeljdeeb.com (www)
Next, I created a CNAME record with the hostname www
and michaeljdeeb.github.io
for the value.
*.michaeljdeeb.com (*)
Another issue I ran into is that subdomains (which I no longer utilize) were directing users to a page served up by Hover. To solve this issue I deleted out any previous records with the hostname *
and created a new CNAME record with the hostname *
and michaeljdeeb.github.io
as the value.
This brings users to a GitHub Pages 404.html, not my 404.html page. I believe without being able to utilize a .htaccess file there’s nothing I can do about this, but if you know otherwise, please let me know.
michaeldeeb.com (Forwarding)
This might be a little Hover specific, but after navigating to the management of michaeldeeb.com, I clicked “Edit” in the “Forward This Domain” row. I put http://michaeljdeeb.com
in the text field and chose not to enable stealth redirection.
This means the URL will change in the browser’s address bar. Now michaeldeeb.com and www.michaeldeeb.com forward to my new domain and any navigation tacked onto the end of the URL will be passed through. For example, http://michaeldeeb.com/blog forwards to my new blog and not just http://michaeljdeeb.com.
On Your Side
After I had configured everything correctly, pages were being routed correctly after about ten minutes. It can take up to a full day for things to go into effect though, so don’t lose hope and be sure to empty your browser cache.