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.

Redirect from main domain to subdomain not working

Discussion in 'General Discussion' started by rjbourne, Oct 6, 2014.

  1. rjbourne

    rjbourne Registered

    Joined:
    Oct 6, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi there

    I am trying to redirect from mysite.com/mylink to mylink.mysite.com. I have set this up through cPanel Redirect (in the same way I have several other redirects, which work fine) but it is not redirecting.

    The subdomain has a separate document root set up and the files in the two locations are not the same so I am positive that it is not redirecting and leaving the domain name as /mylink.

    My .htaccess as a result of this setting looks like:

    Code:
    RewriteCond %{HTTP_HOST} ^mysite\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.mysite\.com$
    RewriteRule ^mylink\/?(.*)$ "https\:\/\/mylink\.mysite\.com\/$1" [R=301,L]
    Any ideas as to what could be going wrong?

    I tried adding a 'simple' redirect (i.e. to another page, rather than a subdomain) and that worked fine.

    Many thanks in advance,

    Richard
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    671
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Have you tried configuring the redirect to the specific page (e.g. index.html/index.php) to see if that makes a difference?

    Thank you.
     
  3. rjbourne

    rjbourne Registered

    Joined:
    Oct 6, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi Michael

    I've just tried that to no avail I'm afraid. Any ideas?

    Thanks.
     
  4. rjbourne

    rjbourne Registered

    Joined:
    Oct 6, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi Michael

    Thanks for your help but I've found the problem - there was a rogue .htaccess file hanging around, I removed that and all is working as expected now.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    671
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page