Serving pages depending on domain name - meteor

Is it possible that several domain names redirect to the same IP (and thus Meteor app), and that this app can detect the domain name from which it is served and redirect to a specific route that would appear as the root route ?
Mickael

I solved my problem. All the answers are here:
https://forums.meteor.com/t/serving-pages-depending-on-domain-name/49439

Related

Mapping Custom Domains to Wildcard Sub-domains

I'm creating a NextJS project which makes use of wildcard subdomains.
I've set up wildcard subdomains on Vercel, so now each wildcard subdomain points to my main NextJS installation. Within the NextJS app, I'm reading the subdomain name and serving the content accordingly.
So, let's say my wildcard entry is *.example.com
Now, all subdomains, such as roman.example.com, greek.example.com, are being served correctly with content coming from my database correctly.
The challenge I'm facing is to map custom domains to each of these subdomains.
For example, if I want myroman.com to map to roman.example.com and mygreek.com to map to greek.example.com, I'm unable to get it to work.
Say, for example, if in myroman.com DNS records, if I add a CNAME record pointing to roman.example.com, and then if I visit myroman.com, it shows me 404 deployments not found error. Note that something like myroman.com is a customer's site, and the only thing I can ask a customer is to add a DNS record to map it to a sub-domain. I cannot take control of their domain or anything like that.
You would see that companies like substack offer such custom domain mapping to their customers.
Can you suggest what's the best way to achieve this? I'm okay to change host or anything to make this work.
Thanks to Krabs, we can host multiple websites inside of our Next.js instance and serve them separately depending on the domain that the user is browsing
https://micheleriva.github.io/krabs/docs/intro/
I hope this is what you are looking for!

Redirect 301 in firebase

I have to do a 301 redirect from a domain with NO www to the one with www like:
example.com -> 301 -> www.example.com (same domain)
I've bee looking to this example in the official doumentation, but it seems like the configuration doesn't considerate the whole URL path, is there any way to accomplish this?
I'm thinking about creating a separate project for the domain without www and create a firebase cloud function that takes all requests and do a redirect from there
is that the way to go? any simpler solution?
You can redirect out f the box in firebase an option I haven't noticed you just go to the following options:
Hosting
Connect domain
You can write your domain like "example.com" without www
Select the Redirect check button
Write your redirect destination, in my case, is the same domain with www
That's it!
A more specific solution for Firebase (and registrar-agnostic) was provided by Jack himself.
This is usually accomplished at the domain registrar level rather than at the app level. If your domain is with Google Domains, these would be the steps.
Edit:
Since you have your domain in GoDaddy, I would suggest to follow the instructions on their help center.

how to create sub-domains

i am going to create some sub-domains on my website.
when i create a sub-domain i must define a directory that sub-domain will refer to newly created sub-domain. but i want a different solution.
i want to detect when a user enters a URL , which sub-domain is used and then do some operation for each special sub-domain.
for example if website user entered a.mysite.com
i extract "a" sub-domain from URL and then without redirecting webpage i load some data in page.
please help me how i do these,on both web-server and localhost?
In general your application doesn't care about the host name, so you have to configure your IIS to handle all requests.
Production only: Create a wildcard DNS record for your domain (e.g. *.domain.tld)
Your IIS site should have no explicit bindings, so that ALL incoming requests hit this application (other sites should still work fine!).
After this you can check the HttpContext.Current.Request.Url and extract the requested subdomain.

multiple domain url routing in asp.net 4

Can Asp.Net 4 Webforms handle url routing for differing domain names?
Ex. www.abc.com
www.admin.abc.com
www.domainname.com
www.admin.domainname.com
I would like to make a single app to handle the requests coming from the above URLs.
Most of the scenarios I have found point to having url routing based on a single domain and multiple web pages.
Thanks!
Yes it can (If I understand your using of the word URL Routing correctly).
Simply set a host-header entry for the application for each of the domains you want to support. You can do this in the IIS.
As a result www.abc.com www.admin.abc.com www.domainname.com www.admin.domainname.com all point to the same web application. Be aware, that sharing a session between multiple domain names might become a problem. (If the user starts surfing with www.abc.com and later uses www.domainname.com)
Another approach would be to use the canonical hostname rule for the IIS 7.5 URL Rewrite 2 Module. That results in having only domain that is visible for the users. E.g. www.domainname.com/myFooPage gets redirected to www.abc.com/myFooPage)
This might be a good approach for SEO

Moving a domain

Hi I am hoping for some advice.
I have just managed to get a .co domain so I wish to point all requests from my .co.nz domain to the .co
I am running IIS7.5
I have created a services site e.g. services.mydomain.co.nz and the website mydomain.co.nz both are running on their own website and app pool.
At the moment I don't want to break any of the web services so I want to keep the services site as services.mydomain.co.nz but I want to automatically redirect website users to the .co domain instead of .co.nz
So far I have added a new host header in IIS and this allows me to hit the website using the .co domain but I can still hit the site using .co.nz
Do I need to create a url rewrite function to help with this?
You can use http redirection in IIS to direct all requests at the old domain to exactly the same path at the new domain.
You want to choose options as I have in this photo:
Include the full base url to the new site, ending at the slash after the domain name. then leave the other options as I have them; this way, any request at the old domain will be sent a 301 "permanent" code to redirect to the new, equivalent page on the new site.
Note that it's important that you do not check the first of those checkboxes under 'Redirect Behavior'; that will make it send all requests to the home page of your site, rather than to the same path url.
This should be on a separate IIS site, by the way.

Resources