HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=16)
-   -   create subdomains with forwarding api (http://www.howtoforge.com/forums/showthread.php?t=6201)

bryxal 14th August 2006 19: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.

Thanks!

sjau 14th August 2006 20:36

Can you explain what exactely you need?

falko 15th August 2006 16:24

Have a look at http://www.ispconfig.org/downloads/m..._src.htm#4_2_3 chapter 2.3.2. Is this what you're looking for?

bryxal 15th August 2006 17: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 17:07

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

sub.domain.com --> domain.com/sub or domain.com/script.php?sd=sub ?

bryxal 15th August 2006 18:03

A very valiant proposition. Just wondering if this would work in the sense of not having a A-name record, when test.example.com 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 18:53

You can create a wildcard entry for the subs and point it to the domain or your IP in the dns...
Code:

*.domain.com.      IN  A    1.2.3.4
Then in the apache config create something like this:
Code:

    DocumentRoot /www/domain/html
    ServerName www.domain.com
    ServerAlias *.domain.com

And then you only need a .htaccess with rewriting... something like this should work
Code:

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 10:20.

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