InMotion Hosting Support Center

At times you may want to 301 domain redirect traffic from one domain to another and this can be done at both the domain level and for specific web pages. For example, domain.com and its web traffic can be redirected to anotherdomain.com OR domain.com/aboutus.html can be redirected to anotherdomain.com/about.html. In this guide we show you how to create a redirect in your cPanel which automatically adds a redirect rule to your .htaccess file.

(Not a current customer and want to spend less time working in cPanel? Click here to learn more about Dedicated Server Hosting and the benefits of having 1-on-1 Sysadmin time included in your plan.)

Redirecting a Domain

  1. Login to cPanel.
  2. Click the Redirects button in the Domains section.
  3. You will then be on the Add Redirect page. Click the drop-down box for Type and choose either a Permanent (301) or Temporary (302) redirect.
  4. Click the next drop-down box and choose the domain you want to redirect.
  5. For the slash '/' field, enter any folder names (if necessary).
  6. Enter the address you want to redirect to in the Redirects to section.
  7. Choose if you want to "Only redirect with www." "Redirect with or without www." or "Do Not Redirect www."
  8. Check the box if you want to create a Wild Card Redirect. This will add the the file/folder name after the url when it redirects. For instance, example.com/test.php would redirect to example2.com/test.php.
  9. Click Add when finished.

  10. You are finished when you see a green message with the details of your redirect.


Congratulations, now you know how to create a redirect in your cPanel! Did you know? You can also create a 301 redirect directly in your .htaccess file.

Was this article helpful?
Continued Education in Course 203: Managing your Domains in cPanel
You are viewing Section 3: Setting up a 301 Domain Redirect in cPanel
Section 2: Wildcard Subdomains and DNS
Section 4: How to Add an Addon Domain in cPanel

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

n/a Points
2018-08-26 1:55 am

I had followed the steps given in the video and Set up redirecting,it's been it is not working for me.

 

Incase DNS zone needs to be changed or updated,Pls advise me witth relevant article or Video.

 

Thanks.

Staff
3,017 Points
2018-08-27 10:48 am
Hello. Sorry to see that your redirect is not working properly. In order for the redirect to work the DNS (A Record) must point to the server that you are creating the redirect on. If it is not then the domain will never reach the server with the redirect you created and therefore will not redirect. It's also possible that the Content Management System (CMS) you are using to maintain your website may not accept those redirect rules and therefore you would need to configure redirects using the Documentation for the CMS you use to maintain the website.
n/a Points
2018-06-20 4:45 pm

Hi Gurus,

I am in trouble, I successfully got the 301 done but now it gives 2 redirections at landing page as follows;

Example issue:If I type mysite.com in Google webpage speed test, now it is giving me errors;

"Avoid landing page redirects for the following chain of redirected URLs.

http://mysite.com/

https://mysite.com/

https://www.mysite.com/

"

I have lot of subdomains (each country one) but in below example I included only for sample, Can any one tell what did I do wrong below;

#Force non-www:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.af.mysite\.com [NC]

RewriteRule ^(.*)$ https://af.mysite.com/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^www\.ax.mysite\.com [NC]

RewriteRule ^(.*)$ https://ax.mysite.com/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^www\.al.mysite\.com [NC]

RewriteCond %{HTTP_HOST} ^www\.zm.mysite\.com [NC]

RewriteRule ^(.*)$ https://zm.mysite.com/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^www\.zw.mysite\.com [NC]

RewriteRule ^(.*)$ https://zw.mysite.com/$1 [L,R=301]

 

## Server Defaults

ServerSignature Off

DefaultLanguage en-US

AddDefaultCharset utf-8

## Index Preferences

Options All -Indexes

IndexIgnore *

## GZIP Compression

<IfModule mod_deflate.c>

  # Compress HTML, CSS, JavaScript, Text, XML and fonts

  AddOutputFilterByType DEFLATE application/javascript

  AddOutputFilterByType DEFLATE application/rss+xml

  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject

  AddOutputFilterByType DEFLATE application/x-font

  AddOutputFilterByType DEFLATE application/x-font-opentype

  AddOutputFilterByType DEFLATE application/x-font-otf

  AddOutputFilterByType DEFLATE application/x-font-truetype

  AddOutputFilterByType DEFLATE application/x-font-ttf

  AddOutputFilterByType DEFLATE application/x-javascript

  AddOutputFilterByType DEFLATE application/xhtml+xml

  AddOutputFilterByType DEFLATE application/xml

  AddOutputFilterByType DEFLATE font/opentype

  AddOutputFilterByType DEFLATE font/otf

  AddOutputFilterByType DEFLATE font/ttf

  AddOutputFilterByType DEFLATE image/svg+xml

  AddOutputFilterByType DEFLATE image/x-icon

  AddOutputFilterByType DEFLATE text/css

  AddOutputFilterByType DEFLATE text/html

  AddOutputFilterByType DEFLATE text/javascript

  AddOutputFilterByType DEFLATE text/plain

  AddOutputFilterByType DEFLATE text/xml

</IfModule>

## EXPIRES CACHING ##

<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/svg+xml "access plus 1 year"

ExpiresByType image/jpg "access plus 1 year"

ExpiresByType image/jpeg "access plus 1 year"

ExpiresByType image/gif "access plus 1 year"

ExpiresByType image/png "access plus 1 year"

ExpiresByType text/css "access plus 1 month"

ExpiresByType application/pdf "access plus 1 month"

ExpiresByType text/x-javascript "access plus 1 month"

ExpiresByType application/x-shockwave-flash "access plus 1 month"

ExpiresByType image/x-icon "access plus 1 year"

ExpiresDefault "access plus 2 days"

 

<filesMatch ".(css|js)$">

Header set Cache-Control "max-age=2628000, public"

</filesMatch>

 

</IfModule>

## Set Default PHP version

#AddHandler application/x-httpd-php56 .php

#AddHandler application/x-httpd-php70 .php

 

Header always set Access-Control-Allow-Origin "*"

 

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

 

 

RewriteCond %{HTTPS} off

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$

RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

 

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$

RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$

RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$

RewriteRule . /index.php [L]

</IfModule>

 

<IfModule mod_rewrite.c>

   RewriteEngine On

   RewriteCond %{HTTP_HOST} ^mysite\.com$

   RewriteCond %{SERVER_PORT} 443

   RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$

   RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$

   RewriteRule ^(.*)$ https:\/\/www\.mysite\.com\/$1 [R=301,L]

</IfModule>

# php -- BEGIN cPanel-generated handler, do not edit

# NOTE this account's php is controlled via FPM and the vhost, this is a place holder.

# Do not edit. This next line is to support the cPanel php wrapper (php_cli).

# AddType application/x-httpd-ea-php56 .php .phtml

 

# php -- END cPanel-generated handler, do not edit

 

Staff
42,352 Points
2018-06-21 9:42 am
Sorry for "Avoid landing page redirects" issue. This normally happens because of issues with conflicts with SSL best practices. Check out this article for a really good breakdown on the issue. It should help you to determine what's happening.

n/a Points
2018-06-13 2:59 pm

I am adding a subdomain for a WP blog to my main html domain.

-The subdomain will be referred to and used as mydomain.com/blog. It will be loaded with a WP installation after it is created.

When I create the subdomain, it creates blog.mydomain.com.

I want the the blog to accessible as mydomain.com/blog

but the subdomain is not showing up as /blog under my domain.

Following subdomain creation there is a folder named blog.mydomain.com

existing above and outside of my /public_html/ folder

but not inside /public_html/ 

and there is no /blog subfolder created in my /public_html/ as a result of the subdomain creation.

Information I reviewed led to me believe that just creating the subdomain from within my cpanel account will create  blog.mydomain.com and assign /blog as the location all under my /public_html/ folder (ie. domain name)

Is something wrong here? Did I miss a step? How would the area blog.mydomain.com be set up to be referred to as just mydomain.com/blog? 

 

 

Staff
42,352 Points
2018-06-13 3:43 pm
If you are creating a subdomain and want it to be recognized as "blog.domain.com", then you will need to create it under the Subdomains section of the cPanel. Additionally, you would select it as the domain name in the installation of your WordPress. I use the Softaculous application for installation of WordPress - it provides for a domain name and a directory. If you want to put the blog in a domainname.com/blog folder, then simply select your domain name, then in the directory section add the name of the folder. The folder CANNOT exist already, or the installation will fail. If you're manually creating the WordPress installation, then you will need to create the subdirectory and then upload the WordPress files into that folder.

I hope that helps to clarify the issue. At this point, it would probably be simpler to simply delete what you've created and then start the installation again.

If you have any further questions or comments, please let us know.
n/a Points
2018-03-05 12:34 am

We have canceled a redirect and cleared our cache, yet it keeps telling us that our server is set to redirect. www.literaryaffairs.net

Can you help us? We're trying to reinstall Wordpress and it won't allow us to get to the proper page.

Thank you!

Staff
1,173 Points
2018-03-05 12:48 pm
301 redirects are remembered by your browser. You will need to clear the cache in your browser or use a private/incognito window to ensure it is not seeing that old redirect. You should also check your .htaccess file to ensure the redirect is no longer present.
n/a Points
2018-02-09 1:14 pm

I want to forward/ redirect my website to another hosted url but with MASKING. how to do that?

viz. www.abc.com to www.xyz-servlet.com but it should show as www.abc.com only as the backend url is masked

Staff
3,017 Points
2018-02-09 1:20 pm
Domain masking is prohibited. You will need to contact a developer for further assistance in masking your domain name to your visitors.
n/a Points
2017-11-15 6:08 am

how will i redirect like domaina.com/its link to another domainb.com/its links for all the link in domainA to redirect all the link in domainB for example https://www.xclusivetek.com/contact-us to https://www.xclusivetek.com/contact-us

Staff
42,352 Points
2017-11-15 10:57 am
Your example was two identical domains. Don't redirect like that, it would not work. The instructions tell you how to use the interface in cPanel to create a redirect. If you require specific cases of redirects such as redirecting all the links from domain A to domain B, then check out the instructions provided in Setting up a 301 permanent redirect.
n/a Points
2017-10-20 4:30 pm

Hi.What if I want to redirect a domain name to another domain but wanted to retain the very domain name in the search var?For example I have a new Domain name www.domainA.comand I want it to be redirected to www.domainB.com but on the same way you still wanted to see www.domainA.com in your search var.How am I going to do this?Thank you

Staff
3,017 Points
2017-10-20 6:03 pm
I'm sorry, cPanel does not have an option to add domains to manage in this manner. Creating an Alias domain and redirecting each link would be the only way to accomplish keeping both domains with the same content.
n/a Points
2017-09-13 3:38 am

Question: I have got an issue on google redirection when i search on google my domain it shows same on desktop such as domain.com/product but it seems something different in mobile wherein i insist to see such as m.domain.com/product after having redirected by anyone on google search engine. It does not matter that it looks same in desktop and mobile but after once clicked by anyone on their mobile it should see like m.domain.com/product on behalf of domain.com/product. 

Staff
42,352 Points
2017-09-13 10:47 am
Hello,

Sorry for the confusion with the re-direct issue with your mobile site. I'm not 100$% what the issue is, but it seems that if someone is looking in Google and goes to your site from a mobile device, then it should convert to the mobile site. Your website should be able to determine the device that is requesting to view your site and convert the URL to the correct URL -be it for desktop or a mobile device. If it's not doing that, then you will need to consult with a developer/programmer or the appropriate support personnel (developer of your software) in order to correct the issue.

I hope this helps to answer your question, please let us know if you require any further assistance.

Regards,
Arnel C.
n/a Points
2017-09-07 4:56 pm

If I set up a redirect in cpanel from XXX.org to YYY.org, will the 

email functionality still work as before the redirect?

I.E.  Will email to Person@XXX.org by handled correctly

without being routed to YYY.org ?

Staff
31,313 Points
2017-09-07 5:49 pm
No, this should not affect your email functionality.

Thank you,
John-Paul
n/a Points
2017-08-05 8:49 am

How long does it take to redirect a domain to another? I redirected already but still no, does it take 24hours to redirect? 

Staff
10,771 Points
2017-08-07 9:53 am
I advise double-checking your DNS settings, to make sure that domain is pointing to the server where the redirect is happening. Once that is clear, you may want to clear your browser cache as well.
Staff
42,352 Points
2017-07-05 6:20 pm
Hello Chris,

Redirects only affect the website you're re-directing FROM. You have to look closely at the link that people are getting the 404 error. Remember that web servers receive a REQUEST for a specific URL. So, if you're on a website the URL brings you to that server. The redirect would act on that request and re-direct you to the new location. I hope that's clear. You would only make changes where you want to re-direct from.

If you have any further questions or comments, please let us know.

Regards,
Arnel C.
n/a Points
2017-06-24 2:46 am

Thank you. Shows it is done. It appears it may take a while for the redirect ot go through. I will check to be sure it is working tomorrow. 

13,821 Points
2017-06-26 7:07 am
This redirect should be almost instantaneous. If it's not working, you can remove it and try it again. If that doesn't work you may want to reach out to the Support department for further assistance.
n/a Points
2017-04-06 7:44 am

Nice clear and easy process - thanks for the video

n/a Points
2016-11-21 12:16 am

Can I do this for subdomains also?

Staff
43,761 Points
2016-11-21 7:10 pm
Yes, it will work for subdomains.
n/a Points
2016-10-28 12:40 pm

Hi, I got a redirect installed on my domain it works except that when Google shows my website it refers it to the http version. My htaccess file looks like this:

RewriteOptions inherit

RewriteEngine on

RewriteCond %{HTTP_HOST} ^mydomain.com$ [NC]

RewriteRule ^(.*) https://www.mydomain.com/$1 [R=301,L]

# RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]

# RewriteRule ^(.*) https://www.mydomain.com/$1 [R=301,L]

# Force www: from http://stackoverflow.com/a/4958847/1078583

# RewriteCond %{HTTP_HOST} !^$

# RewriteCond %{HTTP_HOST} !^www\. [NC]

# RewriteCond %{HTTPS}s ^on(s)|

# RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Plus other redirects for individual pages such as:

# RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]

# RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$

# RewriteRule ^fr\/index\.html$ "http\:\/\/www\.mydomain\.com\/fr\/index\.php" [R=301,L]

Thanks

2,858 Points
2016-10-28 1:20 pm
Lisa, .htaccess redirects won't affect how Google crawls your website. It will however redirect anyone that actually navigates to the page you have set up for the redirect. You will need to <a href="https://webmasters.googleblog.com/2015/12/indexing-https-pages-by-default.html">let Google know to only crawl your HTTPS site</a>.
n/a Points
2016-10-11 7:24 am

Thank you this post was very useful and very helpful

13,821 Points
2016-10-11 7:28 am
That's great to hear. We love feedback!

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

38 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!