How do I move a site from one url to another? - language-agnostic

I have an ASP.NET web application hosted on DiscountASP.NET with its domain name registered on GoDaddy. This site is working perfectly and runs great, but I hate the domain name.
So now, I decide to purchase a domain name I like better. How do I set it up so that this domain name runs the same web app as my original application, but using the new domain name instead of the old one (i.e. I don't want to redirect to the old url, I want everything to work under the new url)?

This should be quite simple. Go to the host/registrar of your new domain and point it to the same ip addresses that the godaddy url points to.
You can have the old url and new url coexist. The DNS servers just map to the the physical IP your app is hosted on.
If you've been naughty and use absolute urls/directories in your app, you will have to rewrite some code. All the while reciting the mantra... that's why I should have used relative references...

Either move the application files over and create a redirect from the old URL to the new, or set up a rewrite under the new URL to transparently pass requests to the existing one.

Related

Let netlify use a subdomain thats also used on a different site

(how) is this possible:
I have 2 netlify sites main-app and sub-app.
main-app has a custom domain (www.main.com).
I now want to make the 2nd site sub-app using the custom domain sub.main.com but Netlify forbids this and notes that I already use the respecity domain main.com.
Any help?
It is possible to use subdomains. It is discussed in detail in their docs: https://docs.netlify.com/domains-https/custom-domains/
You already have a Netlify subdomain where your app is hosted, of type myapp.netlify.app. Now you need to point your subdomain to this instance. If you use for example Namecheap, you do it like this: https://www.namecheap.com/support/knowledgebase/article.aspx/9776/2237/how-to-create-a-subdomain-for-my-domain/
Here is Netlify's instructions for doing this if you don't host your domain with them (aka not using Netlify DNS) https://docs.netlify.com/domains-https/custom-domains/configure-external-dns/
Similar DNS editing as in Namechrap will be seen on all other domain hosts. Once this is set up and has had time to propagate (give it 10 minutes to an hour) you proceed with hooking it up in Netlify. Your error message should now be gone.
Remember that you need different DNS records on your domain host for the main app and the sub app.
You can add a subdomain in the netlify panel and in you DNS manager / hosting provider add the records as CNAME with the domain provided by netlify.

How do I persist custom subdomains in firebase hosting without redirects

I've set up my custom domain with firebase hosting using their CNAME and A record details. Visiting http://sub.example.com redirects to https://example.com (not what I wanted)
I want to persist my subdomain (https://sub.example.com) in the address bar without the 301 redirect to (https://example.com) that I'm currently getting. Is this possible to set up this behavior within firebase hosting itself? I'd also like to point this sub domain to a certain html file/directory that I configure.

A good practice to set my custom domains on Heroku

Basically, Heroku gives you a domain named by default: XXX.herokuapp.com.
On my own, I have a set of REST apis that I would like to set on a domain named: api.myDomain.com.
On the same time, I have my HTML files (web view) distributed by the same server as the REST API.
It's similar to this; embedding static files on server in a dist folder.
I expect the domain serving those HTML/JS files to be www.myDomain.com.
I thought about putting them clearly on a distinct server dedicated to static files, but the fact is that Single Page Application should be controlled by a server, in order to make the refresh works (F5 redirecting to index.html), that's why I chose to use the same server as REST apis.
An alternative would be to dedicate ANOTHER server to treat only static files, independent of the REST Apis' server.
How to deal with both domains (api and www) while sources being on the same servers?
Or should I completely rethink the strategy?
You can just set both domains to direct to your page by setting it up in your app settings, but then I'm pretty sure that would mean api.myDomain.com/dist would show your static things, and www.myDomain.com could show your api things.
https://devcenter.heroku.com/articles/custom-domains
Another way you could do this might be by doing some things with your actual code, but we don't really know what your code is like right now.

Display a different URL for a subdomain

I've developed an application that a client might access at a URL like this: http://example.com. In this case, I own and control http://example.com.
I now have a case where another company would like present my application as their own by changing some of the branding and the URL (say: http://companyx.com). The application and all the data will still remain hosed with me just like it was at http://example.com.
What's the best way to handle this? I was going to create a separate directory for this company so I can update the branding (mainly just a logo) to make it specific to them, but I'm not sure how I can make this directory accessible to people going to a directory on the company site (http://companyx.com). Using sub-domains is also an option if this makes it easier. Assume that I'll be able to add records to companyx.com's DNS, etc.
You need to create a separate directory, then create a subdomain at sub.example.com and point it to directory (you can do this from your hosting control panel). Now your company needs to point their desired url (within their domain) to your subdomain.
IMHO this is the cleanest solution, if you need to have control over the site's content.
edit
what company needs to do is to point cname record of domain to your url and it should work, (otherwise you will need to get separate ip for your subdomain in order to point A record there)

'Cloaked' domain forwarding not working as expected

I've registered a domain with www.domain101.com. We'll call it www.example.com. I used their 'cloaked forwarding' option on my heroku app, which we'll call example.herokuapp.com. If I want to navigate to the posts index page, I would go to example.herokuapp.com/posts, of course; however, when I try this with my cloaked domain - www.example.com/posts - it takes me to the landing page. What's more, the url is constantly set to 'www.example.com' and the title of each page is "EXAMPLE.COM". I can click buttons on the pages and navigate through my website, but the url remains strictly at 'www.example.com'.
I used the forwarding option available on the website. What else should I be doing?
Domain cloaking uses a frame to make visitors' browsers show the cloaking domain in the location bar, while having the actual content hosted somewhere else. That's why the location bar never changes when you navigate around the site; and it isn't surprising that domain101's cloaking implementation doesn't forward path information to your Heroku app.
What you should do instead is configure a DNS server to direct traffic for your domain directly to Heroku. The simplest option for that on Heroku is the Zerigo DNS Add-on, which is free if you're hosting a single domain. You can also find DNS servers provided by lots of other people if you prefer.
Once you've configured a DNS server, you also need to tell your registrar that the DNS server you chose is the primary DNS for your domain. The way to do that varies between registrars, so you should check domain101's documentation for details.