The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Rewrite rule not working.

Discussion in 'General Discussion' started by imran_khan, Jul 16, 2013.

  1. imran_khan

    imran_khan Well-Known Member

    Joined:
    Jun 10, 2013
    Messages:
    154
    Likes Received:
    0
    Trophy Points:
    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.
     
  2. imran_khan

    imran_khan Well-Known Member

    Joined:
    Jun 10, 2013
    Messages:
    154
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Hello,

    Any help or suggestion.

    Thanks,
    Imran Khan.
     
  3. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    I suggest you do the redirection in cPanel-> Domains-> Redirects
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  5. imran_khan

    imran_khan Well-Known Member

    Joined:
    Jun 10, 2013
    Messages:
    154
    Likes Received:
    0
    Trophy Points:
    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.
     
Loading...

Share This Page