imran_khan

Well-Known Member
Jun 10, 2013
154
1
16
cPanel Access Level
Root Administrator
Hello,

I have created rewrite rule from cpanel but one url is working second giving me cpanel default apache page.
Web site abc.com is hosted on Cpanel server and xyz.com is external website.

1). Subdomain cp.abc.com successfully redirected to http://cp.xyz.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cp.abc.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.cp.abc.com$
RewriteRule ^/?$ "http\:\/\/cp\.xyz\.com" [R=301,L]

2). Subdomain mail.abc.com should redirect to https://webmail.xyz.com but giving default apache page.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mail.abc.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mail.abc.com$
RewriteRule ^/?$ "https\:\/\/webmail\.xyz\.com" [R=301,L]

I have also ensured IP and document root path on both subdomains under /var/cpanel/userdata/username/ directory and it is correct.

Thanks,
Imran Khan.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,108
579
493
Finland
cPanel Access Level
Root Administrator
I suggest you do the redirection in cPanel-> Domains-> Redirects
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
Hello :)

The "mail" subdomain is added as a "CNAME" record by default in the DNS Zone of the domain name it's associated with. You can confirm this via:

"WHM Home » DNS Functions » Edit DNS Zone"

You can remove the entry and add it as a standard subdomain if you prefer to setup a redirect through the cPanel interface.

Thank you.
 

imran_khan

Well-Known Member
Jun 10, 2013
154
1
16
cPanel Access Level
Root Administrator
Hello Michael,

I have already checked the CNAME and deleted it. I have redirected from software firewall and it is working.
Any way thanks for the support.

Thanks,
Imran Khan.