Is there a reason to use one technique over the other or should I just use whichever is more convenient? Roughly, I want to redirect myshortsitename.com to mylongersitename.com.
3 Answers
In fact, DNS does not redirect, It just resolves your given domain name (record) into a IP address.
In .htaccess, You can set different type of redirection using 301 (permanent) & 302 (temporary)
.htaccess redirection is very much useful, When you want to redirect certain set of URLs from your domain to another domain. .htaccess redirection can also be used to redirect URLs within the same domain.
When you want to redirect your old business name to new business name, better to use 301 redirection, This will benefit in SEO. Most of your old customers might search you online using "old brand name", which can be redirected to "new website"
DNS does not redirect. It only resolves a domain name to an IP address.
With DNS, you can assign two domain names to the same IP address, but that is it. Nothing more.
If you need a redirect, then you will have to use the web server to achieve this.
Assuming the redirect is permanent you will get the fastest user experience by pointing the DNS records directly to the destination. The page load speed and the page route are important from several perspectives:
Your visitors will be happier and less likely to abandon prematurely.
Google's ranking takes into account page load speed.
No need to maintain an .htaccess file just for the sake of a redirect.
301/302 redirects may have issues with properly propagating the referrer header.
The more stops you have along the way, the more likely it becomes to have failures.
On the other hand, if not done properly and making the two domains seem as separate web sites, you risk being conceived as a site duplicator, and at diluting your traffic between the two domain names. To mitigate these risks I would advise to define the short domain name's DNS record as a CNAME that translates to the long domain name, and to embed in your pages canonical urls that will tell Google that both forms actually point to the same resource.
-
Using a DNS to point two or more domain names to a single IP address is only a small part of the process that needs to take place to have domain names serve the same content. The web server needs configuring as well. In addition, there are new issues that come along with this that require work to compensate for. It is generally not advisable to point multiple domain names to the same site as a replacement for a redirect. Dec 28, 2015 at 17:26
-
I've been successfully using this technique for years with a .org domain for which I had also a .com domain. When you'd search Google you'd always get the .org link even if you've searched for something such as site:mysite.com. If the site is properly written there shouldn't be a need for any special support for the CNAME, except for some tweaking in special cases such as Github Pages and similar services. The speed gain is IMHO well worth it.– avnrDec 28, 2015 at 17:37
-
I have been too. I was just pointing out that assigning a DNS A or CNAME record to multiple domain names is only a fraction of what is needed in regard to configuration and then once done, there is additional work required to compensate for this this technique with such things such as canonical tags, redirects, etc. Dec 28, 2015 at 17:42
-
@closetnoc You are right but I already mentioned in the answer the canonical urls. As for redirects, well, I never had a need for these as the whole point was to go directly to the page, skipping the extra hop. It would be interesting though to put together some proper guide that will thoroughly cover the issue.– avnrDec 28, 2015 at 17:56
-
We do have answers that cover this, but I am sure none of them are fully complete but rather more to the specific question from the OP. SE is doing a documentation something site(s) which may be useful for guides such as this - I have no idea - I have not looked. BTW- Canonical tags are only really necessary if more than one site are serving the same content without a redirect. Some day, I should get into this more when the opportunity arises, or you can! ;-) Dec 28, 2015 at 18:03