Setting up a 301 Domain Redirect in cPanel

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, and its web traffic can be redirected to OR can be redirected to 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, would redirect to
    9. Click Add when finished.

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.

Thoughts on “Setting up a 301 Domain Redirect in cPanel

  • Our old website is on a domain with extension .nl and we created a new one with .com/nl. All paths have changed though. I now want to combine a wildcard redirect and ‘normal’ redirects. Is that possible?

    So for instance, I’ve made a specific redirect from .nl/page1 (old page) to .com/nl/pagenumber1 (new page). I then want it to follow that redirect. But for instance I have not made a specific redirect for .nl/page2. I then want it to use the wildcard and lead to .com/nl/page2 (even though that might give a 404, at least they will be on the new website then). Hope you understand my point. I’ve tried doing this, but it doesn’t seem to work. the way I’ve set it up…

  • Hello Sir….

    I am working on a HTML Website and it is working with www. and without www. but I want that it work only at so please tell me how can I do it ?

  • I configer 1 domin and set redirecting domin too but when i hit in browser it will show (

    This site can’t be reached


    • Ensure the redirect contains the correct URL and is free of misspellings. Also, test that the URL you are redirecting to is up and active.
      Thank you,

  • I’ve set up the 301 redirect in Cpanel and it works fine for direct links to the main domain. However, I am still able to see other pages or folders (About Page, etc) when I try navigating to them. I thought this should not be possible if the “/” was left blank…? 

    Thanks in advance for your help.

  • I’m having difficulty redirecting several of my pages to a different domain, so far only one redirect works. 

    These redirects don’t work even after waiting more than 24 hours (if that is even necessary) and using multiple browsers on several devices, including Incognito mode in Chrome which should be equivalent to clearing browser cache. 

    The one redirect that did work, was done about a month ago and worked almost immediately. 


    Please help!



    • Sorry for the problem with your re-directs. In order for us to assist you, we would need more specifics on what you’ve done or the domains involved. If you want to handle it privately, then please contact our live technical support team using the contact information at the bottom of the page.

  • I want to register some domains and 301 redirect them to my site here. Just want to be sure, Do i need hosting for the new domains that will be forwarded? I will prefer not to spend the money in hosting them

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



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

  • 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 in Google webpage speed test, now it is giving me errors;

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

    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 ^(.*)$$1 [L,R=301]

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

    RewriteRule ^(.*)$$1 [L,R=301]

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

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

    RewriteRule ^(.*)$$1 [L,R=301]

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

    RewriteRule ^(.*)$$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/

      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 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”




    ## 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 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]


    # 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


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

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

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

    When I create the subdomain, it creates

    I want the the blog to accessible as

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

    Following subdomain creation there is a folder named

    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 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 be set up to be referred to as just 



    • If you are creating a subdomain and want it to be recognized as “”, 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 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.

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

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

    Thank you!

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

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

    viz. to but it should show as only as the backend url is masked

    • Domain masking is prohibited. You will need to contact a developer for further assistance in masking your domain name to your visitors.

  • how will i redirect like link to another links for all the link in domainA to redirect all the link in domainB for example to

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

  • 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 but on the same way you still wanted to see in your search var.

    How am I going to do this?

    Thank you

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

  • Question: I have got an issue on google redirection when i search on google my domain it shows same on desktop such as but it seems something different in mobile wherein i insist to see such as 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 on behalf of 

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

      Arnel C.

  • If I set up a redirect in cpanel from to, will the 

    email functionality still work as before the redirect?

    I.E.  Will email to [email protected] by handled correctly

    without being routed to ?

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

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

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

  • 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} ^$ [NC]

    RewriteRule ^(.*)$1 [R=301,L]

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

    # RewriteRule ^(.*)$1 [R=301,L]

    # Force www: from

    # 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]


Was this article helpful? Let us know!