How do I redirect /CPanel URL -> domain:2222

ja3

Verified User
Joined
Mar 28, 2004
Messages
51
First create a directory named cpanel in /var/www/html. Then make a index.php file in that directory with the contents:

<?php header("Location: http://yourhost.com:2222/"); ?>

Then edit the /etc/httpd/conf/httpd.conf file and add the alias:

Alias /cpanel /var/www/html/cpanel/

I've not checked this myself but I think it will work.

Greets,
ja3
 

aldhy

Verified User
Joined
Jul 20, 2019
Messages
10
how if I want to redirect domain.com/cpanel to domain.com:2222 ?
it still use the current domain without redirect to hostname
 

scriptkitty

Verified User
Joined
Jul 10, 2019
Messages
40
how if I want to redirect domain.com/cpanel to domain.com:2222 ?
Code:
 cd /usr/local/directadmin/data/templates/custom
 cp ../virtual_host2.conf .

Add the following near the bottom of the file /usr/local/directadmin/data/templates/custom/virtual_host2.conf beneath |CUSTOM4|

Code:
Alias /cpanel /var/www/html/redirect.php
Code:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
 /usr/local/directadmin/dataskq d
 service httpd restart
 

network

Verified User
Joined
Jul 7, 2019
Messages
39
Code:
 cd /usr/local/directadmin/data/templates/custom
 cp ../virtual_host2.conf .

Add the following near the bottom of the file /usr/local/directadmin/data/templates/custom/virtual_host2.conf beneath |CUSTOM4|

Code:
Alias /cpanel /var/www/html/redirect.php
Code:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
 /usr/local/directadmin/dataskq d
 service httpd restart
thank you ..
 
Top