Skip to main content

How to point a sub domain of one account to sub domain of another account

Comments

10 comments

  • cPRex Jurassic Moderator
    Hey there! The simplest way would be to use a redirect from the primarydomain.co.uk account. You can do this from the cPanel >> Redirects page. Try that and let us know how it goes!
    0
  • RussellDavies
    Hey there! The simplest way would be to use a redirect from the primarydomain.co.uk account. You can do this from the cPanel >> Redirects page. Try that and let us know how it goes!

    Thanks for replying. If i use a redirect won't that just show the site under the current domain though? What I wanted was for the url to be newsite.primarydomain.co.uk rather than show the development url (i.e. newsite.devdomain.co.uk).
    0
  • cPRex Jurassic Moderator
    Thanks for the additional details. Yes, the redirect would change the URL. The easiest option may be to create an Alias domain - this just sets up Apache with multiple domains pointed to the same document root. If that doesn't work well, you may need a custom .htaccess rule to handle the rewrite and redirect. I've had good luck with this in the past for similar situations: RewriteCond %{HTTP_HOST} ^(www\.)?original-domain\.com$ [NC] RewriteRule ^ http://www.destination-domain.com%{REQUEST_URI} [L,NE,P]
    but you may need to tweak that as necessary for your specific situation.
    0
  • RussellDavies
    Thanks for the additional details. Yes, the redirect would change the URL. The easiest option may be to create an Alias domain - this just sets up Apache with multiple domains pointed to the same document root. If that doesn't work well, you may need a custom .htaccess rule to handle the rewrite and redirect. I've had good luck with this in the past for similar situations: RewriteCond %{HTTP_HOST} ^(www\.)?original-domain\.com$ [NC] RewriteRule ^ http://www.destination-domain.com%{REQUEST_URI} [L,NE,P]
    but you may need to tweak that as necessary for your specific situation.

    I'll give this a go. Thanks
    0
  • RussellDavies
    Thanks for the additional details. Yes, the redirect would change the URL. The easiest option may be to create an Alias domain - this just sets up Apache with multiple domains pointed to the same document root. If that doesn't work well, you may need a custom .htaccess rule to handle the rewrite and redirect. I've had good luck with this in the past for similar situations: RewriteCond %{HTTP_HOST} ^(www\.)?original-domain\.com$ [NC] RewriteRule ^ http://www.destination-domain.com%{REQUEST_URI} [L,NE,P]
    but you may need to tweak that as necessary for your specific situation.

    Ok, so i've used the Parked domain option but it's just forwarding the user to the dev url and not displaying the site under the url I wanted. Looks like this is causing an issue with our network at work because it's essentially a redirect which is being blocked by our network policy. Isn't there a way to set the DNS of the destination domain to use a CNAME or A record to point to the site?
    0
  • cPRex Jurassic Moderator
    No, there isn't a way to use DNS for that is that's what happening, so you'll need to try the .htaccess redirection.
    0
  • RussellDavies
    No, there isn't a way to use DNS for that is that's what happening, so you'll need to try the .htaccess redirection.

    Unfortunately i get an internal server error when i try it
    0
  • cPRex Jurassic Moderator
    I'm not able to provide exact code samples, but .htaccess is the way to go for this issue. Are you able to contact your host to have them take a look at this issue?
    0
  • RussellDavies
    I'm not able to provide exact code samples, but .htaccess is the way to go for this issue. Are you able to contact your host to have them take a look at this issue?

    Its our own server so not sure our hosting company will be much help
    0
  • rbairwell
    Ok, so i've used the Parked domain option but it's just forwarding the user to the dev url and not displaying the site under the url I wanted.

    This sounds like a .htaccess style issue - where it is detecting which domain name is being accessed and then redirecting to the "correct" one (such as adding www. etc). It could also be some code in the site which is detecting the hostname. The fact the parked domain is working and then it is redirecting you to the dev url indicates to me that "cPanel wise" everything is working correctly and that it is code within the site itself which is doing the redirect.
    0

Please sign in to leave a comment.