How to Create a Redirect for Your Website

The redirect option is available in your cPanel. Login to your cPanel and click Redirect for setting redirections for your website.

If you are doing the redirection manually, these rules should be added to your .htaccess file located in your public_html folder. 

This rule will redirect all none SSL traffic to the SSL (https) portion of your site: 

RewriteEngine On 
RewriteCond %{SERVER_PORT} !=443 
RewriteRule ^ https://yourdomain.com%{REQUEST_URI} [NS,R,L] 

In addition use one of the following rules, www.yourdomain.com is different from yourdomain.com. You will need to redirect all traffic from one to other.

If your SSL is for www.yourdomain.com you will want to use the first rule to redirect all yourdomain.com traffic to www.yourdomain.com. This rule will direct all traffic to yourdomain.com to www.yourdomain.com.

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^yourdomain.com$ 
RewriteCond %{REQUEST_URI} !^.*www.*$ 
RewriteRule ^(.*)$ http://www.yourdomain.com [R=301] 

If your SSL is for yourdomain.com you will want to use the first rule to redirect all www.yourdomain.com traffic to yourdomain.com. This rule will direct all traffic to www.yourdomain.com to yourdomain.com. 

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$ 
RewriteRule ^(.*)$ http://yourdomain.com [R=301] 

*replace yourdomain.com with the domain you need to redirect to.

  • 28 Users Found This Useful
Was this answer helpful?

Related Articles

How to Change Your cPanel Password

This tutorial will teach you how to change your cPanel password. Please remember to make your...

How to create Cronjob via cPanel?

1. Log into your cPanel account.2. In the "Advanced" section, click on "Cron Jobs" Icon. 3....

How to Increase PHP Upload Limit, Memory & Post Max Size

In some cases, default server settings may not let you upload larger files via your website, or...

How to Reset my cPanel Account Password?

If you can access your cPanel account, follow these steps to reset your password:1. Log into your...

How to Use Cron Jobs Feature on cPanel

Introduction In this guide, you will learn how to use Cron Jobs feature. Cron jobs allow you to...