Help with Domain Forwarding

Status
Not open for further replies.
I'm honestly not even sure that I'm using the right wording in my subject, but here's my problem:

Just started a GitHub pages site. The address works fine, as is, but is something like: github.io/pagename/page/index.html

Bought my own Domain name from Google Domains

Would like to have it so that: www.mydomainname.com/page/ would go to my GitHub page instead.

I have subdomain forwarding setup, so I can type in: example.mydomainname.com and it will forward to the page, but then it completely loses the address structure, and goes back to: github.io/pagename/page/index.html

I've tried searching for the answer myself, but I'm just way over my head at this point. Any ideas?
 
You don't really want to do domain forwarding. Domain forwarding is just forwarding... ALmost like creating a redirect, so once you get to that page, the forwarding is done and your pages all have their old original crusty ugly URL.

I'm not so sure how GOogle Domains handles their domains, I've used other registrars (Hover, mostly, which I heartily recommend to everyone), but typically you want to look for an area where you can point your domain to a different DNS hostname.

Your domain registrar will allow you to point an external DNS host, and so you'd point that to Github's DNS. You can find GitHubs DNS by googling it. And then within GIthub after pointing to their DNS from Google for your domain, you have to create a handler usually called a CNAME that will handle requests for that domain.

That's the general idea. I don't know the specifics of Google Domains or Github pages, but this looks like a great tutorial: http://www.curtismlarson.com/blog/2015/04/12/github-pages-google-domains/

(Oh, and just an FYI, pointing to a different hostname can take up to 24-48 hours... though it's usually MUCH quicker than that, like 3-4 hours for you and most people to see the change, but back in the olden days, it'd easily take 48 hours, so the caveat is still 'this may take 48 hours...')

If you've gone through this tutorial and it's still not working, you should also doublecheck that you've created your site correctly. If the links on your site point to the old URL, then even if the custom domain gets you to the right place, once you click on a link, it will start using the original URLs again. THere's two types of URLs, relative and absolute URLs. A relative URL will be a URL that is *relative* to the path of the file that you're on... e.g., it will usually begin with a slash, and look something like:

/about/index.html
/index.html
/about/team/index.html
or

about/team/index.html (Rarely this...)
../../about/team/index.html (Less so this...)

Those URLs are all relative to the page that you're on. The intitial slash is telling the server that handles the request, "Hey, go to the root of this server... and then go to the about directory... and then go to the index.html page." Without the slash, it's telling the server, "Hey, stick to the directory you're in and look for a sub-directory called 'about,' and then team, and then go to index.html." The one that begins with ../../ is telling the server, "Oh so.. you're in this directory right now, well, jump up two directories, and then drill down to about/team/index.html...". I've butchered this for simplicity, but that's the general idea of relative URLs.

An absolute link points to an absolute path regardless of where you are on your website, and for web development, this usually starts with something like an "http://" (not always... but... usually).

So if you have a link to...

http://john.github.com/pages/about/index.html ...

Then that link will ALWAYS take you to that address, and it won't substitute the custom URL. So... doublecheck your URLs if the tutorial I linked to up there doesn't work for you.
You want to use relative URLs in most cases when you're linking to URLs within your website.
 
You don't really want to do domain forwarding. Domain forwarding is just forwarding... ALmost like creating a redirect, so once you get to that page, the forwarding is done and your pages all have their old original crusty ugly URL.

I'm not so sure how GOogle Domains handles their domains, I've used other registrars (Hover, mostly, which I heartily recommend to everyone), but typically you want to look for an area where you can point your domain to a different DNS hostname.

Your domain registrar will allow you to point an external DNS host, and so you'd point that to Github's DNS. You can find GitHubs DNS by googling it. And then within GIthub after pointing to their DNS from Google for your domain, you have to create a handler usually called a CNAME that will handle requests for that domain.

That's the general idea. I don't know the specifics of Google Domains or Github pages, but this looks like a great tutorial: http://www.curtismlarson.com/blog/2015/04/12/github-pages-google-domains/

(Oh, and just an FYI, pointing to a different hostname can take up to 24-48 hours... though it's usually MUCH quicker than that, like 3-4 hours for you and most people to see the change, but back in the olden days, it'd easily take 48 hours, so the caveat is still 'this may take 48 hours...')

If you've gone through this tutorial and it's still not working, you should also doublecheck that you've created your site correctly. If the links on your site point to the old URL, then even if the custom domain gets you to the right place, once you click on a link, it will start using the original URLs again. THere's two types of URLs, relative and absolute URLs. A relative URL will be a URL that is *relative* to the path of the file that you're on... e.g., it will usually begin with a slash, and look something like:

/about/index.html
/index.html
/about/team/index.html
or

about/team/index.html (Rarely this...)
../../about/team/index.html (Less so this...)

Those URLs are all relative to the page that you're on. The intitial slash is telling the server that handles the request, "Hey, go to the root of this server... and then go to the about directory... and then go to the index.html page." Without the slash, it's telling the server, "Hey, stick to the directory you're in and look for a sub-directory called 'about,' and then team, and then go to index.html." The one that begins with ../../ is telling the server, "Oh so.. you're in this directory right now, well, jump up two directories, and then drill down to about/team/index.html...". I've butchered this for simplicity, but that's the general idea of relative URLs.

An absolute link points to an absolute path regardless of where you are on your website, and for web development, this usually starts with something like an "http://" (not always... but... usually).

So if you have a link to...

http://john.github.com/pages/about/index.html ...

Then that link will ALWAYS take you to that address, and it won't substitute the custom URL. So... doublecheck your URLs if the tutorial I linked to up there doesn't work for you.
You want to use relative URLs in most cases when you're linking to URLs within your website.

I really appreciate you taking the time to write out such a detailed reply!

That link you sent me helped a ton. I followed the steps there and was up and running within literally 10 minutes. The funny thing is that I'm almost positive that I tried to use that guide before, but I must have screwed up one of the steps, because I could never get it to work.

Thanks again!
 
Status
Not open for further replies.
Top Bottom