Jump to content

Creating Subdomain


Devine

Recommended Posts

This really isn't a php issue. Something like...

 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.yoursite\.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/%1 [L,R]

 

In your .htaccess will redirect http://foo.yoursite.com to http://yoursite.com/foo. So now, all you need do is have php create the foo (mkdir) directory within your web root.

Link to comment
https://forums.phpfreaks.com/topic/62329-creating-subdomain/#findComment-310128
Share on other sites

This really isn't a php issue. Something like...

 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com
RewriteCond %{HTTP_HOST} ([^.]+)\.yoursite\.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/%1 [L,R]

 

In your .htaccess will redirect http://foo.yoursite.com to http://yoursite.com/foo. So now, all you need do is have php create the foo (mkdir) directory within your web root.

 

This doesnt work.

Link to comment
https://forums.phpfreaks.com/topic/62329-creating-subdomain/#findComment-310160
Share on other sites

Also, when I try to add any files to the "beta" folder (with SmartFTP)... It says I do not have permission / folder doesn't exist...

 

Is my mkdir ok?

 

function createfolder( $folder )
    {
    $folder = explode( "/" , $folder );
    $mkfolder = '';
    for(  $i=0 ; isset( $folder[$i] ) ; $i++ )
        {
        $mkfolder .= $folder[$i] . '/';
        if( !is_dir( $mkfolder ) )
        mkdir( "$mkfolder" ,  0777);
        }
    }

Link to comment
https://forums.phpfreaks.com/topic/62329-creating-subdomain/#findComment-310169
Share on other sites

Also, when I try to add any files to the "beta" folder (with SmartFTP)... It says I do not have permission / folder doesn't exist...

 

Is my mkdir ok?

 

function createfolder( $folder )
    {
    $folder = explode( "/" , $folder );
    $mkfolder = '';
    for(  $i=0 ; isset( $folder[$i] ) ; $i++ )
        {
        $mkfolder .= $folder[$i] . '/';
        if( !is_dir( $mkfolder ) )
        mkdir( "$mkfolder" ,  0777);
        }
    }

 

I realize that when I create the folder, it doesn't set the "user" or "group".. Is there a way to do that?

Link to comment
https://forums.phpfreaks.com/topic/62329-creating-subdomain/#findComment-310171
Share on other sites

Also, when I try to add any files to the "beta" folder (with SmartFTP)... It says I do not have permission / folder doesn't exist...

 

If your going to create the directories in php your best to use php for all interactions. This is to do with the fact that ftp runs under your username, while php runs under apache's process username. This can cause qute a few issues on shared hosting.

 

I realize that when I create the folder, it doesn't set the "user" or "group".. Is there a way to do that?

 

chmod.

Link to comment
https://forums.phpfreaks.com/topic/62329-creating-subdomain/#findComment-310179
Share on other sites

If your going to create the directories in php your best to use php for all interactions. This is to do with the fact that ftp runs under your username, while php runs under apache's process username. This can cause qute a few issues on shared hosting.

 

Is there a way to set the user/group to be my ftp user via php?

Link to comment
https://forums.phpfreaks.com/topic/62329-creating-subdomain/#findComment-310185
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.