This seems like it should be a trivial task but isn't proving to be one for me...
How should I go about pointing multiple domain names to the same GitHub Pages hosted site?
Example:
I have created an account named test on GitHub and created a repository test.github.io
I bought test.com
I configured test.com's DNS as below
I have told GitHub Pages to enforce https and look out for custom domain test.com
My site is now live on test.com and www.test.com, woohoo!
DNS Config for test.com:
A # 185.199.108.153 (github's nameserver)
A # 185.199.109.153 (github's nameserver)
A # 185.199.110.153 (github's nameserver)
A # 185.199.111.153 (github's nameserver)
CNAME # www.test.github.io (for www redirect)
I would ALSO like example.com (and a few other domains, foo.com, bar.com and foobar.com) to redirect to test.com
How do I do this?
With an apache server, this would be easy, be GitHub Pages only supports static sites.
Any ideas?
As always, thanks for any suggestions!
The ideal place to have this redirect is your DNS provider. You can redirect foo.com, bar.com, etc. or whatever you want to test.com. Alternatively, if you happen to use Cloud Flare, forwarding can easily be setup from there too.
But if you don't want to do that and insist on using Github only, refer to this answer. What you can do in this case is create another repository (other than test.github.io) with same contents and link it to another domain such as foo.com. You can use Github Actions or something to sync your changes from main repo to the others.
Of course, the only drawback of this method is that for every domain you want to link, you'll have to create an additional github repo.
I've accepted #Prahlad Yeri's answer from above, and am just leaving this here so that other's who stumble onto this question can easily figure out how to do this... As mentioned "The ideal place to have this redirect is your DNS provider"
To do this with domains purchased from domain dot com it is VERY simple, and even INSTANTANEOUS! I can imagine with GoDaddy or other providers it will be similar.
On Domain dot com's control panel:
Log into account for the domain you wish to redirect
Go to "Pointers and Subdomains" on the left sidebar
Choose either "URL Standard" or "URL Stealth" from the pointer options, then enter the desired redirect URL in the "Directory" field
Press Save and you're good to go, immediately!
URL Stealth means that your URL will remain as what the user has typed in, and URL standard means it will display the URL of the site that you've directed to. More documentation on pointers and subdomains (for domain dot com) can be found at domain.com/help/article/domain-management-how-to-update-domain-pointers
Is it somehow possible to redirect example.mydomain.com, a subdomain which does not actually exist, to folder.mydomain.com using either .htaccess or DNS? How can this be achieved?
When I access DNS from the control panel and click on the Web DNS tab, I see Personal web DNS settings, under which I believe I can submit domains and their values. However, I am confused with the type (web alias, web forward, A, CNAME, TXT, SRV, AAAA...). Could someone help me?
If the .htaccess way is simpler, I would then prefer it.
Thank you.
You wouldn't be able to use .htaccess as the subdomain does not exist.
I assume, from the process you described, that you are using One.com hosting. If so, the following guide will be of help:
Manage your DNS settings
Essentially, a web forward DNS entry will work for you:
Click on the Web DNS tab.
In the hostname/domain column, enter the subdomain you would like to redirect.
Set the type to web forward
Set the value to where you would like to be redirected when visiting the subdomain.
Click the (+) sign to save your changes.
It will take up to 90 minutes for your changes to take effect.
Im running SAAS where customer signs up and a script installation takes place in a subdomain, i.e., subdomain.mydomain.com and starts using the site. Now I want to allow my customers to map their FULL domain eg. www.customerdomain.com to subdomain.mydomain.com, something like bloggers.com or wordpress does. How I can do this. I am using Linux dedicated server. Help would be greatly appreciated. I dont want URL masking or redirection.
I'm currently developing a project and have recently faced the exact same issue. Here's two ways you can go about solving it:
Super-easy
A little more tricky, but not impossible
The first would be to allow domain mapping of subdomains (e.g. http://subdomain.example.com). This is dead simple for your users to setup. They would head over to their registrar and create a new CNAME record as follows:
(name) subdomain.example.com -> (record) subdomain.yoursite.com
Unlike changing A Records, this change only takes about 120 mins to fully propagate (compared with up to 72 hrs).
If your users pay for the privilege of using the domain mapping feature (i.e. it's not made available to users on a free plan), then you could could store each user's custom subdomain in your database, then check against this (in .php) when they try to access your website via their custom subdomain. If they're allowed, do nothing, otherwise redirect them to an alternate url.
So that's the easy one over and done with. Now for trickier option. If you have a dedicated IP address, or in your case a dedicated server, you can use the cPanel API to dynamically create A Records, this way users would be able to map their domain (rather just their subdomain) to your website. You would need to make the following A Record for your customer, together with getting them to update their domain's A Record with your dedicated IP address:
Your server:
(name) customersdomain.com -> (record) subdomain.yoursite.com
Customer's registrar:
www -> (record) [YOUR IP ADDRESS]
I'm not going to detail the API process for you, but you can read through the documentation here:
http://docs.cpanel.net/twiki/bin/view/SoftwareDevelopmentKit/ApiAuthentication
Anyways, I hope this helps and that you have fun building your website!
J
The (name) represents the custom domain belonging to your customer (e.g. customerdomain.com). The (record) would point to their subdomain on your SAAS site. So if I signed up to your website with a username of 'nike', you would use 'nike.yoursite.com'.
J
Install the wordpress domain mapping plugin, obviously your wordpress installation is setup for Wordpress MU.
Now the way I understand it you want to give your bloggers the opportunity to host their blog on their own personal domain while still hosting on your sever. Under "Domain Mapping" in "Settings" of "Network Administrator"(Super User).
There is Domain Options:
You want to check the User domain mapping page that's Option 3.
This will allow your blog users to specify the domain of their personal site. One thing to remind them is that their DNS records should point to your web server.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I'm trying to redirect a domain to another via DNS.
I know that using IN CNAME it's posible.
www.proof.com IN CNAME www.proof-two.com.
What i need is a redirection with a path. When someone types www.proof.com, it should take them to to www.proof-two.com/path/index.htm
I know it can be done using Web Server facilities, but I need DNS redirection.
Is this possible?
No, what you ask is not possible. DNS is name resolution system and knows nothing about HTTP.
if you use AWS, a redirect like
mail.foo.com --> mail.google.com/a/foo.com
can be setup as follows:
in s3, create an empty bucket "mail.foo.com"
under Properties -> Static Website Hosting, set "redirect all requests to: mail.google.com/a/foo.com"
in route53, create an A record "mail.foo.com"
enable "alias", and set alias target to the "mail.foo.com" bucket
not a pure DNS solution, but it works ;)
But be aware of, the redirect skips all the URL parameters e.g.: ...?param1=value1¶m2=value2
I realize this is an old thread but FWIW, incase someone else is looking for a way to do this.
While dns does not understand the path portion of the url, it will understand subdomains, so instead of:
www.proof.com IN CNAME www.proof-two.com/path/index.htm
You could use:
www.proof.com IN CNAME proof.proof-two.com
then go to wherever you host proof-two.com and set it to point proof.proof-two.com to www.proof-two.com/path/index.htm.
~ there's always more than one way to skin a cat
Some providers allow this but there are no "pure" DNS solutions since DNS doesn't know anything about the protocol you're using and redirects are a feature from HTTP.
For OVH, see : https://docs.ovh.com/gb/en/domains/redirect-domain-name/
You will have to use the control panel to add your redirection. It will update your DNS zone accordingly.
Let's consider you created a redirection from foo.bar.com to foo2.bar.com/path. OVH keeps the url paths and parameters. So if you try to access foo.bar.com/hello?foo=bar, you'll be redirected to foo2.bar.com/path/hello?foo=bar.
I have a personal project that might help you in solving this issue.
It's an open source redirect solution that allows you to redirect your domain just changing your DNS settings. Link of the project: https://redirect.center/.
To redirect www.proof.com to www.proof-two.com keeping the URL parameters, just set your www DNS entry on proof.com:
www.proof.com IN CNAME www.proof-two.com.opts-uri.redirect.center.
Really it's easy with redirect.center
If you want create a CNAME as :
www.proof.com IN CNAME www.proof-two.com/path/index.htm
using redirect.center your CNAME look as canonical mode as:
www.proof.com IN CNAME www.proof-two.com.opts-slash.path.opts-slash.index.htm.redirect.center.
Now if you want redirect to https website you can add this option:
www.proof.com IN CNAME www.proof-two.com.opts-slash.path.opts-slash.index.htm.opts-https.redirect.center.
Now you can create a CNAME with the canonical mode with slash in your destiny page.
To answer the original question, no, what you want is not possible using only DNS (like everyone has stated). In addition to everything mentioned already, another option is to use a URL redirection service. These types of services can enable you to configure many different types of URL redirects depending on your needs. For example:
Forward a domain apex to a www. subdomain or vice versa
Forward a collection of domain names to a single destination (useful for forwarding domain misspellings, old company names, etc.)
Forward specific domain names to deeply linked pages (like what the OP wants)
A service that does this is EasyRedir. Full disclosure: I developed EasyRedir. There are certainly other options out there though, so I encourage you to have a look around.
DNS won't redirect the path portion of a URL, so that won't be possible.
Adding
www.proof.com IN CNAME www.proof-two.com
will direct access to www.proof.com to www.proof-two.com, where you will need to use web server config to direct users to the appropriate page.
A related work concluded all the below:
Problem:
http://a.com/p1/p2.html should go to http://B.com/p1/p2.html
today, but later when configured manually/automatically, the same
http://a.com/p1/p2.html should go to http://C.com/p1/p2.html
Answers:
DNS - converts name to IP address
Though it can do a lot of redirects, always output is IP address
DNS does not understand the path or protocol part of URL, understands domain part only, that is, a.com only is converted to IP address, so when you hit http://a.com/p1/p2.html may be converted to http://152.132.121.11/p1/p2.html
if you configure wrong in DNS, then you will get 152.132.121.11 (not http://152.132.121.11/p1/p2.html), so you would get some 400s error (400, 403, etc.)
Redirection - this is http://a.com/p1/p2.html can be converted to http://b.com/p1/p2.html
All the methods like GET, POST can work, with if any headers and body, but there is a web server is involved, it could be point of failure, so scalability and availability will be key
If you are on AWS, Route 53 -> API Gateway is possible though custom domains, internally using the Cloud front
It is possible with Amazon Certification Manager, AWS Gateway custom domains & Route53, note the us-east-1 restriction on ACM
Hope that helps someone
I will suppose you have this scenario: You have a unique webserver hosting various websites, each one is supposed to be presented by a separated domain:
http://example.com/customer1/website/page1.html
http://example.com/customer2/website/page2.html
so, the page1.html should be served by www.customer1.com and so on.
create a subdomain inside the example.com dns server (your webserver):
customer1.example.com
in your apache virtual server settings, map the subdomain to the directory that contain the web site for your customer #1, like this:
<VirtualHost *:80>
SetEnv PAGE_ID "customer1"
ServerName customer1.example.com
ServerAlias www.customer1.com
DocumentRoot /your/local/path/webserver/customer1
</VirtualHost>
please note the value for "ServerAlias", it is important for the next step-
at this point, you should be able to navigate to your customer1 website by browsing to:
customer1.example.com
In the DNS settings for customer1.com you must make a CNAME record:
CNAME=www
LOCATION=customer1.example.com
Now, you're enabled to use: www.customer1.com.
My solution to this problem was pretty simple and straight forward. All you need is an IIS server running inside the domain.
Setup CNAME in DNS to point to the IIS server, using host names in IIS to resolve several sites on a single IIS server. I'm using the same IIS server to farm out a few sub domains to external sites.
Then in IIS setup setup redirection for that site to go to your offsite site/path, in my case it was our hosted catalog that I wanted catalog.ourdomain.com to go to. From here all the tweaking is done in IIS. Be sure to enable anonymous authentication so traffic will not be blocked.
While as almost everyone stated already - it's impossible using just DNS. As a workaround I would suggest trying NGINX (http://nginx.org/en/docs/http/request_processing.html).
TL;DR - In NGINX you can create multiple virtual servers that can redirect your request based on the server name.
Ex. http://first.my-server.com redirect to place A and http://second.my-server.com redirect to place B, while both share a single physical server.
You can use htaccess rewrite mod, rewrite to the subfolder if the user is requesting one specific domain not the other.
Of course it is possible to redirect, with the following trick:
Create a new standard primary zone
Name it same as the fictive URL that you want to redirect to
Ensure that this fictive name is different than any AD DNS name
Create A record with following entries:
blank.......................A............................ip-addr-2
www.........................A............................ip-addr-2
What we have here is redirection, essentially. A valid URL will resolve based on the existing DNS primary DNS zone. A fictive URL will be redirected to ip-addr-2. What is important is that the name of this entry is blank, so it will fall down to the next entry in the record and redirect to ip-addr-2
Everyone has already stated this, and I just want to give you another option to a service that can help you. www.301redirect.it is a free service that can redirect your domain (with wildcard) to any destination url.
I want to add a disclosure as well: I'm the developer behind this service and there is a other options out there.
I know this question seems pretty straight-forward, but I'm having a hard time pulling up any answers on Google / Other Forums.
A client has a few domains parked on Network Solutions - not attached to any hosting account. I'm planning to point one of the recently purchased domains to a sub-directory of our main site (hosted elsewhere) - as part of a special promotion that's running.
However, Network Solutions now charges for Web Forwarding. In hopes of avoiding an additional charge I thought I'd use the DNS settings to point the IP to the site - but that just takes the user to the main website's home-page --- and not the specific sub-directory I need it to.
Since the domains are just parked - and not associated with a hosting account, I don't have access to a .htaccess file to deal with 301 forwarding or anything there.
Any ideas? Thanks in advance!
Just point the DNS to your server and set up vhosts for each of the new domains. Then, drop in a one-line JS or PHP index file (or mod_rewrite rule) to redirect to the desired page on your main site.