1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice

Subdomains and www host

Discussion in 'Plesk for Linux - 8.x and Older' started by pran, Apr 26, 2005.

  1. pran

    pran Guest

    0
     
    When a domain admin creates a subdomain, Plesk doesn't create a `www' host and also doesn't have any ServerAlias entry in the domain's httpd.include file. Is this normal by design?
     
  2. jamesyeeoc

    jamesyeeoc Guest

    0
     
    Domain config issue

    When you create a domain, there is a checkbox next to 'www', if it is not check marked, then Plesk will not do the 'www' option.

    If you already have domain(s) defined, you can go back into it's settings and put a checkmark.
     
  3. pran

    pran Guest

    0
     
    Thanks for the reply but my question is about subdomains, not the main domain.
     
  4. jamesyeeoc

    jamesyeeoc Guest

    0
     
    Sorry, I mis-read your post. However, in answer to your question, Plesk does not add a 'www' for any subdomains which are created, nor does the 4PSA product.

    I think their mindset is that there should not be a 'www' before the subdomain and so they have never addressed this issue, which has existed in previous major versions as well.

    Interestingly, in Plesk 6, there were no warnings about modifying the httpd.include file. Now in Plesk 7 Reloaded (at least in 7.5.2) there is a large warning at the top of the file.... They want us to only use the vhost.conf file for any mods...
     
  5. pran

    pran Guest

    0
     
    Any work-around this limitation?
     
  6. jamesyeeoc

    jamesyeeoc Guest

    0
     
    Workaround is done by manually editing the vhost.conf file for the main domain.

    If you want to alias 'www.sub.domain.com'
    then put into the vhost.conf -

    ServerAlias www.sub.domain.com
    RewriteCond %{HTTP_HOST} ^www.sub.domain.com$
    RewriteCond %{REQUEST_URI} !^/subdomains/sub/
    RewriteCond %{REQUEST_URI} !error_docs
    RewriteRule (.*) /subdomains/sub/$1

    This would go between the IfModule tags.

    Remember to change references to 'sub' and 'domain' and 'com' to whatever you really have it named.
     
  7. pran

    pran Guest

    0
     
    Thanks james! Where can I find this file?
     
  8. jamesyeeoc

    jamesyeeoc Guest

    0
     
    Sorry I would have been more specific up front, but lately the posters have not wanted a 'manual' workaround, but a control panel fix....

    Normally this file is in -

    /home/httpd/vhosts/domain.com/conf/vhost.conf

    or for the SSL one -

    /home/httpsd/vhosts/domain.com/conf/vhost.conf
     
  9. pran

    pran Guest

    0
     
    I wasn't able to find vhost.conf but I found an instruction in the httpd.include file:
    Code:
    # ATTENTION!
    # DO NOT MODIFY THIS FILE OR ANY PART OF IT. THIS CAN RESULT IN IMPROPER PLESK
    # FUNCTIONING OR FAILURE, CAUSE DAMAGE AND LOSS OF DATA. IF YOU REQUIRE CUSTOM
    # MODIFICATIONS TO BE APPLIED TO THE CONFIGURATION, PLEASE, PERFORM THEM IN THE
    # FOLLOWING FILE(S):
    # /home/httpd/vhosts/domain/conf/vhost.conf
    # /home/httpd/vhosts/domain/subdomains/<subdomain-name>/conf/vhost.conf
    
    How is vhost.conf merged with httpd.include? For example, I want to modify the sub-domain part of httpd.include, so I would create a vhost.conf file inside the folder of the sub-domain (as stated in the instruction) and put all the modifications there? Do I need to re-define what is already in the VirtualHost section?
     
  10. jamesyeeoc

    jamesyeeoc Guest

    0
     
    Again, my apologies, there are several threads with this topic, and I thought this had already been covered.

    You do *not* want to do this in the httpd.include file. Plesk overwrites this file.

    If the vhost.conf does not exist, then you will have to create a new file.

    If the vhost.conf file does not exist, then make sure you have already created a subdomain in the Plesk CP first, and verify if the file then exists.

    Otherwise put the following text into a new file and save it as vhost.conf

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteMap lowercase int:tolower
    ServerAlias www.sub.domain.com
    RewriteCond %{HTTP_HOST} ^www.sub.domain.com$
    RewriteCond %{REQUEST_URI} !^/subdomains/sub/
    RewriteCond %{REQUEST_URI} !error_docs
    RewriteRule (.*) /subdomains/sub/$1
    </IfModule>

    Of course, change all references to the actual sub and domain you are creating.

    Too many days and nights without sleep, too many posts in too many forums to keep track of....
     
  11. pran

    pran Guest

    0
     
    Eureka! I created a vhost.conf file inside the conf folder of the subdomain with the line:
    Code:
    ServerAlias [url]www.subdomain.domain.com[/url]
    and presto, it worked! (of course, after reloading the web server's configuration file). The full instructions on how to do this can be found here. Thanks james!
     
Loading...