Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,809
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,809
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    I am happy to see you have resolved the issue. Thank you for updating us with the outcome.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice