Redirect from main domain to subdomain not working
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:
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
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
-
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. 0 -
Hi Michael I've just tried that to no avail I'm afraid. Any ideas? Thanks. 0 -
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. 0 -
I am happy to see you have resolved the issue. Thank you for updating us with the outcome. 0
Please sign in to leave a comment.
Comments
4 comments