subdomain for all domains in Vhosts

Discussion in 'Tips/Tricks/Mods' started by enigmatic, Jan 3, 2009.

  1. enigmatic

    enigmatic New Member

  2. falko

    falko Super Moderator ISPConfig Developer

    You can create such vhosts in the main Apache configuration (right before Vhosts_ispconfig.conf gets included).
     
  3. sein

    sein New Member

    Hello Falko.

    But how to use name based vhosts before of "NameVirtualHost <IP>:80", which is included in Vhosts_ispconfig.conf? [1]

    I tried to include some RewriteCond/RewriteRule into the first ("catch-all") VirtualHost of Vhosts_ispconfig.conf, but this configuration got removed (as expected...)

    What i want to do: Redirect webmail.* and mailuser.* (for all domains without the need to configure every single domain) to two different locations.

    The rewrite part is:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^webmail\.(.*) [NC]
    RewriteRule .* https://<IP>:81/squirrelmail/src/login.php [L,R]
    RewriteCond %{HTTP_HOST} ^mailuser\.(.*) [NC]
    RewriteRule .* https://<IP>:81/mailuser/login/index.php [L,R]


    How can i include this rewrites?

    [1] "The NameVirtualHost directive is a required directive if you want to configure name-based virtual hosts."
    http://httpd.apache.org/docs/2.2/en/mod/core.html#namevirtualhost
     
  4. sein

    sein New Member

    Solved: I wrote my configuration into
    /root/ispconfig/scripts/lib/config.lib.php

    Within funktion "make_vhost" you can find the default vhost. (You can search for "ServerAdmin root@localhost". This is the first vhost of Vhosts_ispconfig.conf.) I have included my configuration there and added a new Co-Domain to regenerate apache configuration. It's working ;-).
     

Share This Page