🔔 🔔 🔔 Duyuru: 24. Yılımıza özel indirimler sizleri bekliyor ! Kampanya Kodu : TDATA2024 | Detaylı bilgi için tıklayınız.

How can I Redirect URLs in cPanel


How can I Redirect URLs in cPanel


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/'
%>

 

Force SSL/https redirect

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

 

Bu cevap yeterince yardımcı oldu mu?

Diğer Dökümanlar


  • What is cPanel and how to access it?

    CPanel is a fully featured web-based control panel that allows you to manage your domain through a web interface. cPanel gives you complete control over a vast amount of functions, streamlining...

  • CloudFlare Plugin install on cpanel

    CloudFlare is a performance and security service. With 14 points of presence around the world, a website on CloudFlare typically loads twice as fast, uses 65% less server resources, saves 60% of...

  • Enable Cronjob in cpanel and examples

    What is cron? It is the scheduling daemon of the Linux operating system Cron jobs allow you to automate repetitive tasks on the server that hosts your web site. This is a powerful tool that allows...

  • What is Anonymous FTP and how to enable it

    Anonymous FTP allows you and others that you give permission to, to access your “public_ftp” folder. There are two options available: 1. ftp://ftp.yourdomain.com –This allows...

  • Unable to connect cpanel using IP/whm and IP/cpanel

    If cpanel cannot be accessed using IP/whm and IP/cpanel, but can be accessed using IP:2086 and IP:2082, then here goes the solution for the same. The reason for this issue due to missing some...