Domain with www on different IP than non-www - http

I'm doing my best to learn and understand how DNS works. On my journey, I found something interesting. I've seen several cases, including chanel.com and prada.com, where the website redirects from domain.com to www.domain.com. That's understandable and I've explored this debatable subject in the past. What's new though is that in these cases, the www version is on another IP. So if we open the chanel.com, it makes a 301 redirection to www.chanel.com, which happens to have different IP. What are the potential benefits and reasons of this idea?

A lot of companies have seperate servers or applications to handle redirects, so the real website is only listening to www.example.com and the domain example.com is pointing to the redirect server who is giving the redirect.
This is useful for managing all your redirects in one place, for example you got the domain www.example2.com that should redirect to www.example.com you can handle that easily on the same server. and even redirect to a specific page like www.example.com/example2
Cheers!

Related

How to stop redirection from HTTP to HTTPS

When I access to EC2 with http://XXX.XXX.XXX.XXX, the access was redirected to https://XXX.XXX.XXX.XXX.
Also, EC2 instance does not have certificate for HTTPS.
How do I stop the redirection.
By the way, I am using AMIMOTO of Wordpress.
I am looking forward to your reply.
There are 2 things to consider:
HTTPS redirect is done via server redirect, usually with HTTP status code 301. Depending on your server (nginx, apache etc) there are different ways to achieve that, but assuming it's apache, take a look at this to know what to look for
Once you are hit with redirect, modern browsers cache that 301 response for a long time. So even after you disable it you can still experience redirect. Here's example how to clear that in Chrome. This will obviously affect only your browser and if any customers hit the page, they will still be redirected for quite some time.
But best approach would undeniably be to set up and enable SSL.

Subdomain wildcard redirect

I'm running a minor WordPress (multisite/network) site, on a server using cPanel. The site used to have a lot of subdomains like:
shop.example.com
cars.example.com
music.example.com
and so on...
The problem:
Most of the subdomains are no longer available (neither in the DNS nor anywhere else) - so when you try to reach shop.example.com it just hits a 404.
So my question is:
How do I get all subdomains to redirect to example.com?
What have i done/tried already:
DNS a *.example.com record pointing to the correct IP
DNS CNAME *.example.com record pointing to example.com
Doing this forced it onto the server, so its no longer just a 404, but the server doesn't recognize shop.example.com
Tried messing with subdomains/domain in cPanel (creating a *.example.com), and a couple of other different things
Tried different redirects in cPanel
So what am I doing wrong? I'm pretty sure I need to do a combination of setting up a wildcard DNS record, and doing something in CPanel :P - but I just can't figure out exactly what.
From your post
Doing this forced it onto the server, so its no longer just a 404, but
the server doesn't recognize shop.example.com
You then need to do a 301 Redirect from shop.example.com to wherever you want to go, you can do this is in the CPanel. You will have to do this for each subdomain that that once existed therefore handling any requests that might come.
Unfortunately, there isn't a way to use the wildcard like you can for the IP. Each subdomain is a separate website as far as the webserver software, such as Apache, is concerned. So when you do a redirect you are answering the webserver software question, "OK, I got a HTTP GET request for shop.example.com, what files do I serve up? "
See this section in the CPanel docs for more information on redirecting.

Godaddy URL redirect from HTTP to HTTPS

I host my website on heroku and bought the domain from godaddy, here's how I set my DNS records
Records
A - # - Forwaded - 600 secs
CNAME - www - example.com.herokudns.com - 1 Hour
Forwarding
-- Domain --
Redirect to https://www.example.com
-- Subdomain --
example.com Redirect to https://www.example.com
www.example.com Redirect to https://www.example.com
Expected Behaviour
When I enter example.com or www.example.com, it should redirect to https://www.example.com
Result
Only example.com got redirected to https://www.example.com, www.example.com does not
What went wrong with my configuration ?
You can't have www as a CNAME and also www as a redirect. If you have the www CNAME aliased to example.com.herokudns.com it's going to go directly to your app on Heroku and make a connection. Your app must be the one to force the redirect to https at that point. I don't know what language you are using, but if it's Rails then set config.force_ssl = true in production.rb.
If your domain is pointing at Heroku with an A and a CNAME record, then the "forwarding" settings on GoDaddy will have no effect. To implement forwarding, GoDaddy points the domain to their own servers.
Once you point the domain at Heroku, all HTTP to HTTPS redirects have to be implemented at Heroku. You can no longer use Godaddy's forwarding. In any case, GoDaddy's URL forwarding is badly implemented and unreliable. You should never use it. See GoDaddy's 301 redirect/forwarding has some weird random middleman URL, kills link juice?
How to redirect HTTP to HTTPS at Herouku depends on what programming language you use. Basically, the redirect rule has to be programmed into your application. See their documentation for specific instructions for a variety of cases: Can Heroku force an application to use SSL/TLS? - Heroku Help
To actually use the Domain as the Web Address:
The A Record should be the IP Address
The CNAME only needs to be name: www value: #
Also I like to keep the TTL the same for the A and CNAME records.
Wait about an hour before testing to ensure the servers have propagated.
For Domain forwarding you only need to scroll down to Forwarding and select https or http (make sure that is correct). Then the web address/url to the home page.
Use a permanent redirect for SEO.

http:// vs http://www: Should I use subdomain or permanent redirect

As far as I can work out, http://www.example.com is technically a subdomain of http://example.com.
Is it better to have www.example.com as a separate subdomain (pointing at the same content), or is it better to do a perminent redirect of all traffic from http://example.com to www.example.com (or visa versa)?
Excuse my ignorance, but the reason I ask is that I'm worried that having two locations online (one with the www, one without), could cause problems with SEO, cookies, analytics etc.
Thanks!
G
Yes, if it is the same content, then give it a single URI; and redirect example.com -> www.example.com not the other way around (www. is the convention and is where systems will most likely look first). If you host on both urls, then Spiders and other bots may be smart enough to realize that it is the same, but why rely on it when a simple redirect ensures they know?
This also means a slightly simple web server setup (only hosting a single domain) and will be easier down the road if you do things like enable ssl or load balancing.
The only (arguable) downside to redirects is that it will mean an additional http request if the user gets it wrong.

invalid security certificate and domain names

I recently purchased a security certificate for a website valid for www.example.com but not for *.example.com (wildcard version - more expensive)
The problem i have now is that although users can type http://example.com , the secure version (ssl enabled pages) https://example.com raises the invalid certificate exception - which is totally understandable.
How can i redirect https traffic to the www.example.com version before the request actually hits the server? i tried url rewritting and redirects without any luck. any ideas ?
The website is built using ASP.NET and Hosted on an IIS 7 server.
Thanks!
Spend another few bucks for a (~$30 at Godaddy) for a cheap cert for the shorter domain example.com.
It seems unlikely that a significant number of users users are typing in https://example.com. If they are typing in an address they are probably using http:// or nothing. You should be able to setup 2 virtual hosts, one for http://example.com/, and one for http(s)://www.example.com. Redirect everything from example.com to www.example.com
SSL is negotiated first, so there isn't really anything you can do to redirect connections from https://example.com to https://www.example.com if https://example.com has an invalid certificate.

Resources