create subdomains with forwarding api

Discussion in 'Installation/Configuration' started by bryxal, Aug 14, 2006.

  1. bryxal

    bryxal New Member

    Good day,

    I was wondering if there was a function i could call with the parameters (in PHP) or the general what i need to do to be able to create subdomains with folder forwarding.

  2. sjau

    sjau Local Meanie Moderator

    Can you explain what exactely you need?
  3. falko

    falko Super Moderator ISPConfig Developer

  4. bryxal

    bryxal New Member

    Falko, that is exactly it BUT i want to be able to do it in PHP (in my php pages i should say), either by dabling in the ISP config tables or by importing some files and using the functions to add them.

    basically i want to write a script that will create me a subdomain when X event happens and so on.
  5. sjau

    sjau Local Meanie Moderator

    if its just subdomains couldn't you use then mod_rewrite? --> or ?
  6. bryxal

    bryxal New Member

    A very valiant proposition. Just wondering if this would work in the sense of not having a A-name record, when is looked-up in the dns would it not "fail" if i dont have a dns record set up and am only relying on the mod rewrite? i may be completely off base tho
  7. sjau

    sjau Local Meanie Moderator

    You can create a wildcard entry for the subs and point it to the domain or your IP in the dns...
    *      IN  A
    Then in the apache config create something like this:
        DocumentRoot /www/domain/html
        ServerAlias *
    And then you only need a .htaccess with rewriting... something like this should work
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
    RewriteCond %{HTTP_HOST} ^a(.*)-01\.domain\.com [NC]
    RewriteRule ^(.*) /A%1/$1 [L]
    Last edited: Aug 15, 2006

Share This Page