Login your cpanel
1. Click the Redirects button on the front page under the “domains”
2. Enter the address of the web page to move in the first field.
3. Enter the redirection address in the second field. (this can be a sub domain
and may be listed as a directory on home page).
4. Choose one of the following options in the list:
*Temporary or *permanent
5. Click the Add button.
Redirect URLs in cPanel Servers
Redirect Examples using .htaccess
To redirect an entire site to a new domain:
Redirect 301 / http://www.new-domain.com
The following performs a 301 redirect based on the clients IP address, this could be used for banning IP addresses.
Banning an IP Address using ReWrite
RewriteCond %{REMOTE_ADDR} ^(A\.B\.C\.D)$ RewriteRule ^/* http://www.yourdomain.com/access-denied.html [L]
To redirect a folder and all of the pages or files contained within it to another page or domain.
RewriteEngine On RewriteRule ^foldername/* http://www.domain.com/ [R=301,L]
Domain redirect
RewriteEngine On RewriteCond %{HTTP_HOST} ^mydomain\.co.uk$ [NC] RewriteRule ^(.*)$ http://www.mydomain.co.uk/$1 [R=301,L]
Image Hotlink protection and redirect
RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yourdomain\.com/ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://domain.com/hot-link.gif [L]
PHP 301 Redirect
Insert the following in your index page.
<?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.cpanelkb.net"); exit(); ?>
ASP 301 Redirect
<% Response.Status="301 Moved Permanently" Response.AddHeader='Location','http://www.mysite.com/' %>
Redirect the user to secure connection (https://) can be accomplished with a .htaccess file containing the following lines:
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
In case you wish to force HTTPS for a particular folder you can use:
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} somefolder RewriteRule ^(.*)$ https://www.domain.com/somefolder/$1 [R,L]
The .htaccess file should be placed in the folder where you need to force HTTPS.
HTML Redirect
<meta http-equiv="refresh" content="0;url=http://example.com/new.html">