Types of Domain Redirects - 301, 302 URL Redirects, URL Frame (and CNAME)
Sometimes, you need to redirect your visitors from one domain or link to another but which redirect option to choose?
In this article we will try to show you the differences/similarities of common redirect types and when to use them.
301 Redirect - Unmasked
URL Redirect 301 is a permanent type of unmasked redirect. It should be used if your website was permanently moved to the new address and you want it to be indexed by search engines (all traffic and existing SEO value will be routed to the destination URL). It is considered to be the most efficient and search engine-friendly method for webpage redirection.
301 redirects are particularly useful under the following circumstances:
- You've moved your site to a new domain, and you want to make the transition as seamless as possible.
- People access your site through several different URLs. If, for example, your home page can be reached in multiple ways - for instance, via http://example.com/home, http://home.example.com, http://www.example.com or https://www.example.com - it's a good idea to pick one of those URLs as your preferred (canonical) destination and use 301 redirects to send traffic from the other URLs to your preferred URL.
- You're merging two websites and want to make sure that links to outdated URLs are redirected to the correct pages.
Please note that when moving a page from one URL to another, the search engines will take some time to discover the 301, recognize it and credit the new page with the rankings and trust of its predecessor. This process can be lengthier if search engine spiders rarely visit the given web page, or if the new URL doesn't properly resolve.
302 Redirect - Unmasked
302 redirect is a temporary type of unmasked redirect. It should be used if a certain URL has been changed to a different address temporarily. Search engines will index the original URL and not the destination URL and display the original URL in search results.
So let's say you want to redirect URL A to URL B via 302 redirect.
When you may need it?
- When there is Page A maintenance, you want to temporarily redirect visitors to a temporary Page B.
- When it is important for you to keep URL A indexed but redirect users to some other page.
For example, you sell cell phones and have page labeled “Latest phone model”, which is SEO-friendly. Instead of updating it all the time when a new phone comes out, you can just create a separate page with the new phone and 302 redirect from “Latest phone model” to it. In this case, search engines will keep indexing the “Latest phone model” page while visitors will always be redirected to the page with the latest phone.
- You are promoting links to URL A while content for some reason is currently located at URL B.
URL Frame (also known as URL masking or URL cloaking) is similar to URL Redirect except that instead of redirecting the client to your web page, the web page is displayed in a frame from the server. With this method, the visitor's browser will display your domain name (for example, www.mydomain.com) and some other person’s website.
Sounds cool, right, but are there any cons?
- URL Frame is bad for SEO.
The problem with domain masking is that it creates duplicate content in search engines. Google and other search engines will identify your domains and masked ones as duplicates and decide to serve one over the other; and sometimes, it’s not always the one you want. In short, it is not possible to have a search engine presence for two domains showing the same content.
- Not all websites allow masking itself.
It is possible to prevent URL masking at the hosting server level, so if your domain is giving Forbidden or other similar errors, then most likely, such measures are enabled at the target server side.
CNAME record is actually not a redirect type record but often mistakenly used as such. The main difference between CNAME and other redirects is that CNAME is just a DNS record type (similar to A, TXT and other DNS level records) while 301, 302 redirects and URL frames are hosting server-powered redirects. In other words, CNAME is not redirecting anything but only provides the same IP addresses and other DNS records from the domain you create CNAME to.
You have domainA.com pointed to your hosting server via an A record to some IP: XXX.XXX.XXX.XXX. You have domainB.com for which you have created a CNAME record to domainA.com:
domainB.com CNAME domainA.com
As a result, both domainA.com and domainB.com will be resolving from the same XXX.XXX.XXX.XXX IP address since domainB.com will be using an IP address set from domainA.com because of the CNAME record. Therefore, the CNAME record is not creating an actual redirect or content but only copying DNS records from the target domain.
You may think that since DNS records are the same, both domains will then resolve to the same website, but it is a common misconception. A CNAME record directs web traffic for a particular domain to the target domain’s IP address. Once the visitor reaches that IP address, the local Apache (or other web server) configuration will determine how the domain is handled. If the domain in question is not configured on the server, the server will simply display its default web page (if any).
This may or may not be the web page for the target domain in the CNAME record, depending on how the server is configured.
Even if a server is configured to serve a CNAME record correctly, some advanced websites based on such CMS as Wordpress, Joomla and others may resolve incorrectly if you point a domain to them via CNAME. As they are highly dependable on the domain these websites were developed for, by default, they are not suited to work under 2 or more different domains.
NOTE: It is not recommended to set up a CNAME record for a naked domain (@ or domain.com) as it will make other records for your domain (such as MX or TXT records) invisible. As a result, the mail service will stop working, and the emails will not get delivered properly. It is possible to create a CNAME record for www.domain.com and then set up a redirect from domain.com to www.domain.com as a workaround.
If you have any questions, feel free to contact our Support Team.