Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a site hosted in domain1.com/mysite. I need to be able to point domain2.com to that site, but without doing any redirect (the url has to be the same). The "mysite" is a part of a very complex web app located in domain1.com so i can´t just copy or move it to domain2.com public_html folder.

Both domains are hosted in the same server. Making a symbolic link between the public_html folder of my domain2.com to point to domain1.com/mysite folder would make this possible. The problem is that the 2 cpanel accounts are separate and i can´t access from one to another.

Is there any option in cpanel where i can change the permissions to allow the owner of one domain to access other domain or at least make possible to give the same owner to both domains?

Note that my host is running suPHP and suExec.

share|improve this question

migrated from stackoverflow.com Jun 14 '11 at 21:07

This question came from our site for professional and enthusiast programmers.

    
Do you have command-line access (typically through ssh) to your hosting accounts? Are your web sites hosted on Apache? Are you able to enter custom configuration directives? –  larsks Jun 15 '11 at 1:10
    
Yes i have ssh access and apache. I have a VPS plan so I think i can add custom configuration directives. –  brpaz Jun 15 '11 at 8:14

1 Answer 1

up vote 0 down vote accepted

WARNING: This answer makes lots of assumptions, such as the assumption that both your domain1.com and domain2.com accounts are hosted on the same server. This isn't necessarily a valid assumption, and even if it's true now it's conceivable that it could change in the future. Your hosting company may have opinions regarding the solution presented here, and in order to avoid unnecessary conflict you should probably take your question to them first before attempting any solution presented here.

If you have command line access to your hosting provide and you are able to change the permissions on your home directory, then the following might work, depending on how things are set up at your hosting provider:

  • Log in to your domain1.com account.
  • Set execute permissions on your home directory:

    chmod a+x ~
    
  • Get the path to your home directory because you're going to need it:

    pwd
    
  • Log into your domain2.com account.

  • Rename your existing public_html directory:

    mv public_html public_html.old
    
  • Create a symlink to the domain1.com public_html directory:

    ln -s /path/to/domain1.com/public_html public_html
    
  • Make sure this worked. You should be able to get a list of files in public_html like this:

    ls public_html
    

If this doesn't work, let me know what happens and we'll see if we can come up with another solution. Also, ask your hosting provider, because they may be able to take care of this for you in a more robust fashion.

share|improve this answer
    
It works. Many thanks. –  brpaz Nov 25 '11 at 9:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.