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

Redirect domain to subdirectory of different domain

Discussion in 'Plesk for Linux - 8.x and Older' started by gweilo8888, Jul 6, 2006.

  1. gweilo8888

    gweilo8888 Guest

    Hi all

    I have a feeling the following is possible, with editing of vhost.conf - but I'm not sure how to achieve it. Thoughts?

    What I have:

    * Root access to dedicated server running CentOS3.6 and Plesk8
    *Two domains. One currently in use with physical hosting, the other idle and unconfigured. We'll call them domain1.com and domain2.com.

    What I need to do:

    * domain1.com continues to function normally as it always has
    * domain2.com redirects to domain1.com/subdirectory/

    What I'd like to happen:

    * When you go to domain2.com, it should preferably remain in the browser bar for the first page served from domain1.com/subdirectory without cheating and using frames
    * Both domain2.com and www.domain2.com should forward to the subdirectory of domain1 (doesn't matter if the former forwards to domain1.com/subdirectiroy and the latter to www.domain1.com/subdirectory though)

    For bonus points:

    * Ideally, subdomain.domain2.com should forward to domain1.com/subdirectory/subdomain, if that's at all possible

    The less manual editing of files each time a new subdomain is added, the better (ie. ideally I wouldn't need to physically add a subdomain, just anything.subdomain2.com would automatically go to subdomain1.com/subdirectory/anything without intervention from me after initial setup

    What of this is possible, and how can I achieve it? :)

    Thanks in advance for any help...
  2. jamesyeeoc

    jamesyeeoc Guest

  3. gweilo8888

    gweilo8888 Guest


    I had found and read those threads, but had a few issues:

    * the first thread refers to domains being parked in 4PSA first - I don't have 4PSA, just Plesk 8. Where do I configure the extra domains in Plesk 8? As fully hosted domains? Domain aliases?

    * AFAICT, the method there won't keep the domain in the browser bar

    * AFAICT, I'd need to manually edit vhost.conf every single time I wanted to add a new subdomain, eg. if I had set up subdomain1.domain2.com and subdomain2.domain2.com to return www.domain1.com/subdomain1 and www.domain1.com/subdomain2, and then over the following weeks I needed to subdomain3 through to subdomain84, I'd have to go back and manually edit vhost.conf every single time a new subdomain was added. I'd *really* like to be able to just say something like *.domain2.com return to www.domain1.com/*

    Can anybody figure a way to extend the info in the thread jamesyeeoc linked to achieve any of this?
  4. jamesyeeoc

    jamesyeeoc Guest

    Doesn't matter if you have 4PSA or not.

    See the second thread URL I edited. Then use [L,P] instead of the [L,R]

    As for your 3rd point, write a script to do the modifications for you, then set the script to run upon subdomain creation in the control panel. Or, read up on the mod_rewrite docs at apache.org and modify the posted code to do the 'auto' thing.
  5. gweilo8888

    gweilo8888 Guest

    OK, I'm just a little confused as to where I configure the second domain in Plesk...

    Great - and that will redirect while keeping the domain, without cheating and using frames? That's what I am hoping for...

    OK - I'm not very good at this, but I can certainly try some more. ;)
  6. jamesyeeoc

    jamesyeeoc Guest

    You create the 2nd domain in the control panel, setup for physical hosting. (Just like you did for the first domain)

    Then in that domain's /conf folder, you create a vhost.conf file with the mod_rewrite stuff in it.
    (example: /home/httpd/vhosts/seconddomain.com/conf/vhost.conf
    where ever your particular distro and Plesk setup is storing the domain's files...

    Then you would do the websrvmng command and restart apache (see the other thread for more details)

    Now, if I had the Universal Remote from 'Click', then I would have more than enough time to write all the script utilities that I would ever need to further supplement Plesk's CP....
  7. gweilo8888

    gweilo8888 Guest

    Gotcha, thanks. Been up all night, but I'll try this soon and report back. :)