HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Installation/Configuration (
-   -   create subdomains with forwarding api (

bryxal 14th August 2006 20:59

create subdomains with forwarding api
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.


sjau 14th August 2006 21:36

Can you explain what exactely you need?

falko 15th August 2006 17:24

Have a look at chapter 2.3.2. Is this what you're looking for?

bryxal 15th August 2006 18:01

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.

sjau 15th August 2006 18:07

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

bryxal 15th August 2006 19:03

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

sjau 15th August 2006 19:53

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]

All times are GMT +2. The time now is 03:03.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.