How to Create a Website/Domain Redirect in cPanel

You can create the redirect for your domain in your cPanel. This could simply be to force your website to use www or non-www. In order to do it, it will depend on the cPanel theme you are using. The action will depend on whether you are using the cPanel paper_lantern theme or the cPanel x3 theme. On Todhost servers, the x3 theme has been depreciated but some web hosting servers(not Todhost) still use it.

For cPanel paper_lantern theme:

1. Log into your cPanel.

2. Navigate to the Domains section and click on the Redirects option:

3. Choose the type of redirect you would like to use for your domain:

    Permanent (301): this redirect will update the visitors' bookmarks and direct search engines to the new site.

    Temporary (302): it will redirect the visitor or search engine, but will not update the bookmark and the search engine will continue to index to the original page.


You will also want to read:

How to Create a MySQL Database, a User and Delete Database in Cpanel
How to Create a SubDomain in Cpanel
How to Backup My Website in cPanel
How to force your website url with www or non-www using htaccess
How to optimize your website to use less server resources

NOTE: 301 redirects are permanent. That means the page has moved, and they request any search engine or user agent coming to the page to update the URL in their database. This is the most common type of redirect that people should use. If you set up 302 redirects, Google and other sites that determine popularity ratings assume that the link is eventually going to be removed. After all, it's a temporary redirect. So the new page doesn't have any of the link popularity associated with the old page. It has to generate that popularity on its own.

4. From a drop-down menu, choose the domain name you would like to redirect:

If you want to redirect a single page or directory, you can use the text field following the drop-down menu and enter the name of the folder or file.

5. Enter the full URL of the page your domain will be redirecting to in the Redirects to field.

NOTE: You need to enter the protocol as well, e.g., http://, https://

6. Select if you want your domain to redirect with www. or not:

    Only redirect with www.: The redirect will work if only visitors are using www. as a part of the URL.

    Redirect with or without www.: The redirect will work regardless of using www. as a part of the URL or not.

    Do Not Redirect www.: The redirect will not work if visitors are using www. as a part of the URL.

So a good option to choose in this case is to redirect with www or without www.

7. Check Wild Card Redirect if you would like all files in the current directory to be redirected to the same files names in the new directory.

Also read:

How to Reset or Change to a New CPanel Password
How to Set Up and Delete a Cron Job
How to Setup Google Apps MX, CNAME and SPF records
How to upload files to a website
Overview of Quickinstall

An example of this will be if example.com redirects to example-tod.com, then:

    with Wild Card Redirect: example.com/test/ redirects to example-tod.com/test/

    without Wild Card Redirect: example.com/test/ redirects to example-tod.com

Click on the Add button in order to create the redirect.


Types of Redirects

    301, "Moved Permanently"— This is the recommended redirect for for SEO purposes.
    302, "Found" or "Moved Temporarily"

A redirect sends both users and search engines to a different URL from the one they originally requested. Below are descriptions of some of the commonly used types of redirects.

301 Moved Permanently

A 301 redirect is a permanent redirect which passes between 90-99% of link juice (ranking power) to the redirected page. 301 refers to the HTTP status code for this type of redirect. In most instances, the 301 redirect is the best method for implementing redirects on a website.

302 Found (HTTP 1.1) / Moved Temporarily (HTTP 1.0)

A 302 redirect is a temporary redirect. It passes 0% of link juice (ranking power) and, in most cases, should not be used. The Internet runs on a protocol called HyperText Transfer Protocol (HTTP) which dictates how URLs work. It has two major versions, 1.0 and 1.1. In the first version, 302 referred to the status code "Moved Temporarily." This was changed in version 1.1 to mean "Found."

Also read:

PHP Configuration in cPanel
Step by Step Approach to Password Protect a Directory in cPanel
The htaccess file and its uses



307 Moved Temporarily (HTTP 1.1 Only)

A 307 redirect is the HTTP 1.1 successor of the 302 redirect. While the major crawlers will treat it like a 302 in some cases, it is best to use a 301 for almost all cases. The exception to this is when content is really moved only temporarily (such as during maintenance) AND the server has already been identified by the search engines as 1.1 compatible. Since it's essentially impossible to determine whether or not the search engines have identified a page as compatible, it is generally best to use a 302 redirect for content that has been temporarily moved.


You can create the redirect for your domain in your cPanel. In order to do it, perform the following actions:

1.Log into your cPanel.

2.Navigate to the Domains section and click on the Redirects option:

3.Choose the type of redirect you would like to use for your domain:

    Permanent (301) – this redirect will update the visitors' bookmarks and direct search engines to the new site.
    Temporary (302) – it will redirect the visitor or search engine, but will not update the bookmark and the search engine will continue to index to the original page.


NOTE: 301 redirects are permanent. They mean that the page has moved, and they request any search engine or user agent coming to the page to update the URL in their database. This is the most common type of redirect that people should use. If you set up 302 redirects, Google and other sites that determine popularity ratings assume that the link is eventually going to be removed. After all, it's a temporary redirect. So the new page doesn't have any of the link popularity associated with the old page. It has to generate that popularity on its own.

4.From a drop-down menu, choose the domain name you would like to redirect:

If you want to redirect a single page or directory, you can use the text field following the drop-down menu and enter the name of the folder or file.

5.Enter the full URL of the page your domain will be redirecting to in the Redirects to field.

NOTE: You need to enter the protocol as well, e.g., http://, https://

6.Select if you want your domain to redirect with www. or not:

    Only redirect with www.: The redirect will work if only visitors are using www. as a part of the URL.
    Redirect with or without www.: The redirect will work regardless of using www. as a part of the URL or not.
    Do Not Redirect www.: The redirect will not work if visitors are using www. as a part of the URL.

7.Check Wild Card Redirect if you would like all files in the current directory to be redirected to the same files names in the new directory.:

Example: If yourdomain.com redirects to your-domain.com, then:

    with Wild Card Redirect - yourdomain.com/test/ redirects to your-domain.com/test/
    without Wild Card Redirect - yourdomain.com/test/ redirects to your-domain.com


Click on the Add button in order to create the redirect.


How to Redirect a Domain in CPanel

We will now will look at the proper methodologies to accomplish a redirection of your site url with no adjustment in your domain name. We will take a look at 2 methods for doing this without an adjustment in your domain name.

WARNING: Never create a redirect for yourdomain.com to www.yourdomain.com or from yourdomain.com to yourdomain.com/index.something. Doing either will cause an infinite loop. If you need to control the www and index page, you must use mod_rewrite by adding .htaccess code.

How to redirect a URL:

    Login to cPanel and click the Redirects icon.
    Leave the setting as 301 redirect, as this is preferred by search engines.
    Select the appropriate domain name from the drop-down.
    In the subsequent blank, enter an optional path and file name; this exact name must be typed to trigger the redirect.
    In the large blank, enter the full URL for the redirect target; include http:// or https:// (e.g. http://todhost.com)
    Leave the other settings as they are, unless you know why you want to change them.
    Click the Add button and you are done.

When someone types the exact name you specified, they will be redirected to the target site you specified.

Note: Some URLS will not work, for example URLs with a question mark (?) or a colon (:) will cause an error.
    Apache mod_rewrite and examples
    URL redirect methods, forwarders


cPanel is available on all Todhost Linux hosting plans, including Shared Hosting, Reseller Hosting, VPS and Linux Dedicated Servers.


Case 1: Redirect and continue everything after the URL

The primary alternative will be to show the majority of the same content on one URL as you would the other. For instance, on the off chance that you simply changed your domain to DomainB.com, yet despite everything you have a lot of guests coming to DomainA.com, you would utilize this to demonstrate to all users of the current content that is situated on the new domain, without the need to upgrade both sites.

To do this, you would alter your .htaccess document for the area that your clients will go to, and embed these lines of code:

RewriteCond %{HTTP_HOST} ^DomainA.com

RewriteRule ^(.*) http://DomainB.com/$1 [P]

On the off chance that you are utilizing the filemanager cPanel, then check to make certain that you have the choice to show hidden files selected.

In the case of including this line into your .htaccess record, you will have the capacity to go to DomainA.com/YourPage and it will show the content from DomainB.com/YourPage

Case 2: Redirect an area to a particular url

This is another way you can do the redirect to content of a particular URL, yet keep the domain the same too. In the event that you need guests to go to DomainA.com in view of a particular page while doing as such, you will utilize this code:

RewriteCond %{HTTP_HOST} ^DomainA.com

RewriteRule ^(.*) http://DomainB.com/PathToPageHere [P]

You would utilize this strategy if, for instance, you had an outside blog, for example, one on blogspot.com or possibly a shopping basket on etsy.com that you need individuals to visit your area without completely hosting the domain there.Guests can get to your site utilizing your domain, however see the substance of an outside URL.

Sample 3 Re-directing an IP address

Periodically, there will be a request to re-guide an IP location to a particular URL. The accompanying code indicates how this should be possible in the .htaccess document.

# Redirect all IP location (supplant the ## with the IP address numerals) to same http://domain_name.com

RewriteCond %{HTTP_HOST} ^##\.##\.##\.##

RewriteRule (.*) http://domain_name.com/$1 [R=301,L]

Stipulations/Please read

Cautioning: If utilizing the first choice, web crawlers, for example, Google or Bing will see various destinations with the same substance and can bring about positioning drops in one, or both of the locales. From a SEO outlook, your best choice is to make 301 redirect.

On the off chance that you settle on the second choice, and are utilizing absolute links on your site (which means your connections go to the full URL and not only an individual document) any link will go to the original site that is connected with that link.


4. Redirect an old domain to new domain using htaccess redirect

Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

Please REPLACE www.newdomain.com in the above code with your actual domain name.

In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.

Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

5. How to redirect a subdomain to another page

You might want your sub domain to redirect to another page. To accomplish this, please do the following:

    Login to your cPanel.
    Click the Subdomains icon.
    Make sure you have already added a subdomain to your account.
    At the bottom, click the Manage Redirection link to the left of the subdomain which you would like to redirect.
    In the box, type the URL (www.your-domain.com/optional-stuff) for which you would like a user to be redirected to if they go to the subdomain.
    Click the Save button.

You have now successfully created a redirect for a subdomain. When you visit the subdomain, you will be redirected to the desired page.

 

Which Redirect is Best?

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 should you choose in different circumstances?

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 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, or http://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 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 X to URL Y via 302 redirect. When you may need it?

- When there is Page X maintenance, you want to temporarily redirect visitors to a temporary Page Y.

- When it is important for you to keep URL X indexed but redirect users to some other page.

- You are promoting links to URL X while content for some reason is currently located at URL Y.


URL Frame - Masked

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.xyz.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

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.

For example:

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 work around.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

I have a full backup of account through cPanel. How do I restore it?

It is recommended that you maintain healthy backup of your website and possibly download the...

How To Create, Edit, and Delete a File in CPanel Using File Manager

This tutorial will be useful for you to understand how to create a file, edit a file or delete...

How to Create a MySQL Database, a User and Delete Database in Cpanel

Your cPanel allows you to easily create a MySQL database, create database users, and assign...

How do I create and remove an Addon Domain?

An add-on domain is a separate domain name that you add to your web hosting subscription with...

How to Set Up and Delete a Cron Job

A cron job allows you to run a certain command at times set by the job. For example, you could...

Powered by WHMCompleteSolution