Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: On-the-fly subdomains
PostPosted: November 22nd, 2008, 12:30 pm 
Runite Member
User avatar
Offline

Joined: February 18th, 2007, 1:28 pm
Posts: 598
Location: Mother's basement us
RS Name: Nightgunner5
RS Status: P2P
Clan Name: Bits and Bytes
The site I'm talking about is on a local network, so the domain won't load what I'm talking about if you aren't me.

My basic idea is that for each folder created in the DocumentRoot, Apache will automatically map it to a subdomain. For example, if I went to example.llamalocal.co.cc, the server would look to see if there was a folder called example, if there was, it would use that for the domain, and if there wasn't, it would use the www folder.

The problem is that when I go to example.llamalocal.co.cc/www, the subdomain folder is mapped to www, not example. Here are the .htaccess files in various directories:

Document root
Code:
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^llamalocal\.co\.cc(:443)?$ [NC]
RewriteRule ^favicon\.ico$ /www/favicon.ico [L]

RewriteCond %{HTTP_HOST} ^llamalocal\.co\.cc(:443)?$ [NC]
RewriteRule ^www/(.*)$ http://llamalocal.co.cc/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ([^\.]+)\.llamalocal\.co\.cc(:443)?$ [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 !-d
RewriteRule ^(.*)$ /www/$1 [L]

RewriteCond %{HTTP_HOST} ^llamalocal\.co\.cc(:443)?$ [NC]
RewriteRule ^(.*)$ /www/$1 [L]

RewriteCond %{ENV:REDIRECT_subdomain} =""
RewriteCond %{HTTP_HOST} ([^\.]+)\.llamalocal\.co\.cc(:443)?$ [NC]
RewriteCond /%1 -d
RewriteRule ^(.*) %1/$1 [E=subdomain:%1,L]
RewriteRule . - [E=subdomain:%{ENV:REDIRECT_subdomain},L]

RewriteCond %{HTTP_HOST} !llamalocal\.co\.cc(:443)?$ [NC]
RewriteRule ^(.*)$ http://llamalocal.co.cc/$1 [L,R=301]

www folder
Code:
RewriteEngine on
RewriteBase /

# Make sure we're on the right domain.
RewriteCond %{HTTP_HOST} !^llamalocal\.co\.cc(:443)?$ [NC]
RewriteRule ^(.*)$ http://llamalocal.co.cc/$1 [L,R=301]

RewriteRule ^wp\-(.*)$ /blogs/wp-$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /blogs/index.php [L]

blogs folder (Default WPMU htaccess file)
Code:
RewriteEngine On
RewriteBase /

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>

_________________

Shane wrote:
Just be sure to let me know if they're male or female, sometimes it can be hard to tell :P


Top
 Profile  
 
 Post subject: Register and login to get these in-post ads to disappear
PostPosted: November 22nd, 2008, 12:30 pm 
Runite Member

Joined: September 9th, 2004, 1:47am
Posts: 9047
Location: In your web browserz


Top
  
 
Display posts from previous:  Sort by  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to: