I publish my project to GitLab Pages and add my custom domain. Now I want to redirect the default GitLab url username.gitlab.io/project to my domain name mydomain.com. I add two records in DNS as below:
www.mydomain.com CNAME mydomian.com
www.mydomain.com CNAME username.gitlab.io/project
but it dosen’t work. How should I do?
If you look at an url, for example: http://example.net/foo/bar the domain name is only the example.net part.
DNS only controls domain names, so you will not be able to use CNAME records to point to subdirectories on the target domain.
To do something like that, you would need a webserver which proxies requests to that directory. (Search for nginx reverse-proxy for some examples)
Related
How can I get https://www.test.com to redirect to https://test.com when using GitHub pages to host a static website?
I recently enabled TLS (provided by GitHub/Lets Encrypt) for my static site by setting A records at my DNS provider (namecheap). I've also chosen to "Enforce HTTPS" option in my GitHub repository's settings, which handles redirecting requests from http://test.com to https://test.com. I have a redirect configured through my DNS provider which forwards http://www.test.com to https://test.com, but the one missing piece of the puzzle is forwarding https://www.test.com to https://test.com.
Regarding this issue, GitHub says, "If your domain has HTTPS enforcement enabled, GitHub Pages' servers will not automatically route redirects. You must configure www subdomain and root domain redirects with your domain registrar."
... and my DNS provider says, "It is not possible to set up a URL redirect in the account for the TCP port forwarding from http://www.domain.tld (uses port 80) to https://www.domain.tld (working via port 443)."
I seem to be caught in an infinite loop of the two services saying the other should provide this functionality.
What worked for me:
Change your custom domain to be prefixed with www., like this:
Save the settings and wait until www.example.com resolves and works.
Remove the www. prefix and save again.
Wait for browser and DNS caches to invalidate.
All combinations should lead to https://example.com/ and no SSL error should appear.
GitHub Pages handles redirection between the apex domain and www subdomain automatically as long as you configure the DNS records correctly.
From the GitHub Pages documentation on configuring an apex domain:
If you configure the correct records for each domain type through your DNS provider, GitHub Pages will automatically create redirects between the domains. For example, if you configure www.example.com as the custom domain for your site, and you have GitHub Pages DNS records set up for the apex and www domains, then example.com will redirect to www.example.com. Note that automatic redirects only apply to the www subdomain.
While the docs discuss redirecting from the apex domain to the www subdomain, the reverse direction works as well.
If the apex domain is the desired target (as in this question): set the custom domain value to just example.com.
If the www subdomain is the desired target: set the custom domain value to www.example.com.
Again, this works as long as DNS records are correctly configured for both the apex domain and www subdomain, as described in the docs.
Not the point of this question, but the question When should one use a 'www' subdomain? offers some good insight on using the www or not.
I have a domain name mydomain.com registered at Google Domain. I would like to use it for a static website in Azure.
I would really love to use my naked domain rather than the www version, but I don't think it is possible since when I try to create a CNAME from mydomain.com, I get CNAME records for the root domain are not supported. If anyone has a solution, I am interested.
Custom domain in Azure portal tells me to create a CNAME from www.mydomain.com to diamnis.z16.web.core.windows.net, which I did.
Now, how do I get traffic from the naked domain mydomain.com to go to www.mydomain.com in Google Domains?
You can do that in google domain dns. Follow the below steps -
After you have done the CNAME mapping for www.chartvibes.com, do as mentioned below -
To configure the naked domain, add a "Synthetic Record", and set up a
"Subdomain Forward." In the subdomain text box, enter the # sign and
nothing else.
Select option to 'Forward path'. That should do the root domain forwarding.
You can refer to the below official link too - https://support.google.com/domains/answer/4522141
I created a subdomain sub.domain.com. then I issued a certificate forit. NOw, I want to add a Cname to map a URL address Lms-traffic.manager.net. to the full FQDN of my subdomain.
HOw should I proceed?
A DNS CNAME is an ALIAS for a domain name. A way to set the ip address depending on another name to get its. it does not do redirects.
the URL record is for a redirect , but will not pass any parameters, just the domain name.
You can do a redirect at the host server... httpd.conf file or .htaccess
for example. apache... SEE
https://httpd.apache.org/docs/2.4/rewrite/remapping.html
I suggest doing the redirect at the web server host, because you have a lot more control of what to pass, and where it goes to. and could do it in the .htaccess file.
I started with GitHub Pages and I don't manage to configure my DNS and my GitHub Repository as I want to.
I would like to redirect both mydomain.com and blog.mydomain.com to username.github.com.
I put mydomain.com in the CNAME file in my GitHub repository and added A records for # to 204.232.175.78 and two CNAME records for www and blog to username.github.com the URL blog.mydomain.com give me a GitHub 404 error.
What is wrong with my configuration?
Per the GitHub Pages help page,
You can only have one custom domain for any given set of Pages. If you
want multiple domains to point to the same pages, you will need to
find a service that can redirect the other domains to your Pages
domain.
If you would like to redirect both subdomains (www and blog) to username.github.io, you could use your DNS provider to set up a forward (w/o masking) from www to blog. Then, if a visitor goes to www.mydomain.com or blog.mydomain.com, they'll see the contents of username.github.io, and the address bar will read blog.mydomain.com.
Everytime I try to create a subdomain with this combo, it simply says the page doesn't exist. I have the subdomain directory created, so I'm not sure what I'm doing wrong. for example if I want
subdomain.domain.com, then
domain.com/subdomain will work, but
subdomain.domain.com won't work.
Any insight?
Firstly you will need a DNS record for you subdomain. This can be a CNAME record if you just want the the subdomain to be an alias of the main domain (Canonical Name). If you want the subdomain to be hosted on a different IP address or server then you need a new A record.
From the sounds of it you want a CNAME record for your subdomain created in your DNS manager, and then you want to configure your web server to look at the host headers to map to the sub directory you created. How you go about this depends on the type of web server.