1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Subdomain point to main domain subfolder

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by ndL, Dec 10, 2009.

  1. ndL

    ndL Guest

    0
     
    So i have searched everywhere to answer my issue.

    i run centos 5 and plesk 9.2.3 i think.

    i came up with a problem:

    I do have a subdomain with a forum (ex. forum.mydomain.com) its located /var/www/vhosts/mydomain.com/subdomains/forum/httpdocs/index.php , i am planing to move it to mydomain.com/forum, the new location will be /var/www/vhosts/mydomain.com/httpdocs/forum/index.php

    what should i do exactly to make my odmain (forum.mydomain.com) access the mydomain.com/forum/ folder and instead of mydomain.com/forum/something.php?blabla would be forum.mydomain.com/something.php?blabla , its because i dont want to break any remote seo urls. hope you understood my problem.

    i have root access to my server if needed.

    i am looking for any how-to, step-by-step instructions, which would be great not for my only, but for others too.
     
  2. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    As I know it is impossible to relocate subdomain directory in Plesk. We have discussed recently about it in the one on threads here. Place for subdomain is hardcoded and can be changed during subdomain creation. You can change subdomain document root directory in httpd.include for domain but it will be overwritten by Plesk when you will do something with domain. As I know we have submitted feature request regarding possibility for subdomains relocation but I have no any ETA when it may be implemented.
     
  3. ndL

    ndL Guest

    0
     
    Maybe could you tell what exactly to change in httpd.conf ?
     
  4. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    For example:

    You can try to change httpdocs location for subdomain but not sure that it will help.
     
  5. ndL

    ndL Guest

    0
     
    will try that later and reply with a feedback.

    one more thing, you must add this feature to change subdomains root folder in plesk 9.2.4
    cpanel has it and its a very useful feature. but for those who cant chose between these two softwares, have problems.
     
  6. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    I have submitted request to developers regarding this problem. I will update this thread with their answer as soon as I receive it.
     
  7. ndL

    ndL Guest

    0
     
    so? any news about this?
     
  8. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    Still under developer's investigation.
     
  9. lamc09

    lamc09 Guest

    0
     
    This is exactly my problem. 2 years later and still under developers consideration? For this reason alone I wish I was using CPANEL again.
     
  10. LAM09

    LAM09 Guest

    0
     
    Can someone please provide an update to this. It's causing me so many problems
     
  11. stupidnic

    stupidnic Guest

    0
     
    Create the subdomain in the control panel. Then login as root and remove the httpdocs directory, then create a symbolic link to the directory path in main site's folder structure that points to httpdocs. Then create a vhost.conf file in the subdomain's conf folder to adjust permissions and open_basedir restrictions. Then run websrvmng to pull in the new vhost.conf settings and you should be all set.
     
  12. LAM09

    LAM09 Guest

    0
     
    HI,

    Thanks so much for replying.

    OK so I know nothing about servers. I just googled "creating a symbolic link" and found how to do this via SSH connection. ln -s /var/www/vhosts/domainNAME/subdomains/subdomainNAME/httpdocs/ /var/www/vhosts/domainNAME/httpdocs/subdomainNAME/

    BUT I get an error message "File exists", although I have deleted the httpdocs directory under the subdomain.

    Also, I dont know how to "adjust permissions and open_basedir restrictions" or how to run websrvmng.

    I have about 10 subdomains I need to do this for. Would it be possible to provide a bit more info on this or do you know of a URL with instructions?

    (PLESK people, can someone just automate this like CPANEL plz?)
     
    Last edited by a moderator: Jan 11, 2011
  13. stupidnic

    stupidnic Guest

    0
     
    If you know nothing about servers then you should probably not be doing this, you should hire a professional to help you. I am not responsible for you messing up your server. Having said all that....

    You have the order of your symbolilc link arguments backwards.

    the command should be:

    Code:
    ln -s /var/www/vhosts/domainname/httpdocs/folder/ /var/www/vhosts/domainname/subdomains/subdomainname/httpdocs/
    
    You will need to adjust your permissions to allow things to work properly.

    create a vhost.conf file in /var/www/vhosts/domainname/subdomains/subdomainname/conf and put something like the following in it (adjusted to suit your environment):

    Code:
    <Directory /var/www/vhosts/domainname/subdomains/subdomainname/httpdocs>
    php_admin_value open_basedir "/var/www/vhosts/domainname:/tmp"
    Options FollowSymLinks
    </Directory>
    <Directory /var/www/vhosts/domainname/subdomains/subdomainname>
    Options FollowSymLinks
    </Directory>
    
    Then execute /usr/local/psa/admin/bin/websrvmng and restart your web server.

    That should get you up and running.

    It should be noted that due to file system permissions issues you will not be able to upload content to the subdomain's web space using the subdomains FTP login, but you will be able to do so using the main domain's FTP login, if the content was uploaded by that user initially. The same applies for the opposite direction.

    Also, if PHP safe mode is enabled (and really it's useless and should be turned off 99% of time) this will cause your PHP scripts to not work either. So... make sure it is disabled in the subdomain's config at the very least.
     
    Last edited by a moderator: Jan 11, 2011
  14. LAM09

    LAM09 Guest

    0
     
    Thanks again for responding (especially so quickly)! Don't worry I won't be blaming you if anything goes wrong and I am only messing with a test subdomain at the moment.

    OK - so here's where I am at.

    1) If I delete (actually I just renamed) the httpdocs under the subdomain and then type in
    " ln -s /var/www/vhosts/domainname/httpdocs/subdomainfolder/ /var/www/vhosts/domainname/subdomains/subdomain/httpdocs/"
    I get an error message of /var/www/vhosts/domainname/httpdocs/subdomainfolder//httpdocs/' is not a directory: No such file or directory.
    Q: Should I be leaving the httpdocs folder or is there something I am missing?

    2) I have created the conf file in readiness.

    3) To run websrvmng to pull in the new vhost.conf - do I just type "/usr/local/psa/admin/bin/websrvmng -r" as /usr/local/psa/admin/bin/websrvmng on it's own seems to do nothing?
     
  15. stupidnic

    stupidnic Guest

    0
     
    Just to confirm here, you are replacing the references "domainname" and "subdomainname" with the necessary domain name and subdomain names right? It is impossible to make this a cut and paste operation.
     
  16. LAM09

    LAM09 Guest

    0
     
    Ha ha - yes, I might be new to Plesk but it was obvious to me to change those to correct naming conventions

    If I keep the httpdocs, it seems to work but creates some sort of infinity loop inside subdomain > httpdocs > subdomain >httpdocs etc. If I delete httpdocs it says no such file or directory.
     
  17. stupidnic

    stupidnic Guest

    0
     
    remove the trailing slash on the second argument for the link so....

    Code:
    ln -s /var/www/vhosts/domainname/httpdocs/folder/ /var/www/vhosts/domainname/subdomains/subdomainname/httpdocs
    
    That's probably what's causing the problem.
     
  18. LAM09

    LAM09 Guest

    0
     
    Hi I tried without the last slash and it recreated the httpdocs folder under the subdomain, and seems to have copied everything from the domain subfolder to that location.

    I then did /usr/local/psa/admin/bin/websrvmng -r and visited the URL
    - with the www gives the plesk welcome page
    - without the www gives Forbidden 403 You do not have permission to access this document.
    I have direct folder browsing disabled on the main domain and yes, there is content in that folder.

    I'm not sure why this is so difficult or at least why its not a nice and simple function in the interface. It should just ask me which folder to point the subdomain at ideally (which I understand for Plesk pre version 9, this was the case).

    Any clues as to what's going wrong here?
     
  19. stupidnic

    stupidnic Guest

    0
     
    Please remember that any settings applied to the domain do not apply to the subdomain. The subdomain is its own area in the plesk interface and has it's own settings that are controlled from that location.

    If www doesn't work then chances are you probably didn't create the subdomain with the www option.

    The 403 just means you aren't allowed to view the information at that location. This could be a misconfiguration in the vhost.conf, or just that you don't have an index.html in that folder, and you don't have folder browsing enabled for the subdomain.

    Please check your configuration first.
     
  20. LAM09

    LAM09 Guest

    0
     
    I should have explained that these subdomains are existing subdomains which I migrated from a server running CPANEL to a VPS with Plesk.

    The DNS records are there for all the subdomains
    EG

    <domain>. A <IP>
    www.<domain>. CNAME <domain>.

    THIS WORKS


    <subdomain>.<domain>. A <IP>
    www.<subdomain>.<domain>. CNAME <subdomain>.<domain>.

    THIS DOES NOT WORK


    There is no option in Plesk 9.5 on Linux to request a leading www. There is for a domain but not for a subdomain. I would have to include this in the actual subdomain name for it to appear, but that would still leave me with a Plesk welcome page on the url without the www (I tried it yesterday just to see if it could fix the issue)

    I use htacess a lot, so I was the person who set the 403 on direct folder access. But the content is there, including the index.html (existing subdomains which were functioning perfectly previously).

    Can I check about the command lines you suggested - Is nothing supposed to happen when executed? Do you just get a new line or a confirmation message? As I am not getting anything to confirm that these are being successfully executed....
     
    Last edited by a moderator: Jan 11, 2011
Loading...