DNS Wildcard + subdomains on subdirs + Wordpress MU

Using a single web hosting account to host multiple sites

DNS Wildcard + subdomains on subdirs + Wordpress MU

Postby humaneasy » Mon Feb 19, 2007 3:05 pm

Hi,

This is somehow related with an old question I posted earlier and that Richard already replied a ton of times, probably. Sorry for that.

So, now I'm using a solution you talked once regarding subdomains and subdirectories but now I need it to work also with WordpressMU in the same wildcarded DNS space and I'm having issues just with that (and not with WPMU).

The domain in question is http://healthblogs.org and the problematic subdomains all give this error:
Site Temporarily Unavailable
We apologize for the inconvenience. Please contact the webmaster/ tech support immediately to have them rectify this.

error id: "bad_httpd_conf"

You can check them at http://faq.healthblogs.org/ http://moon.healthblogs.org/ http://ourstats.healthblogs.org/ and http://support.healthblogs.org/

The .htaccess in questions is:
Code: Select all
Options +FollowSymLinks

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Show Stats
# :: added this to show AWStats stats
RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html)/?(.*)$ [NC]
RewriteRule ^.*$ - [L]

# Rewrite www.domain.com to domain.com
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^(.*)       http://%1/$1 [R,L]

####################################
#
# Here below start the rules that may cause the error  ;(
#
####################################

# mod_dir fix.
# :: Added from other mod_rewrite.com recipe
RewriteCond %{HTTP_HOST} ^([^\.]+)\.healthblogs.org$ [NC]
RewriteCond %{DOCUMENT_ROOT}/subsites/%1%{REQUEST_URI}/ -d
RewriteRule !/$ %{REQUEST_URI}/ [R=301,L]

# If directory exists for subdomain, rewrite it.
# :: Added from other mod_rewrite.com recipe
RewriteCond %{HTTP_HOST} ^([^\.]+)\.healthblogs.org$ [NC]
RewriteCond %{DOCUMENT_ROOT}/subsites/%1/ -d
RewriteCond %1%{REQUEST_URI} !^([^\.]+)/\1(/.*)?$
RewriteRule ^(.*)$ /subsites/%1/$1 [QSA,L]

# /subsites/subdomain/ --> subdomain.healthblogs.org
# :: Added from other mod_rewrite.com recipe
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_URI} ^/([^/]+)(/.*)?$
RewriteCond %{DOCUMENT_ROOT}/subsites/%1/ -d
RewriteRule .* http://%1.healthblogs.org%2 [R=301,L]

####################################
#
# Here below start the WPMU rules that work quite fine :)
#
####################################

#uploaded files
RewriteRule ^(.*)?/?files/(.*) wp-content/blogs.php?file=$2 [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>

Help please. The site is already in production :\

Best and thanks again,
Lopo
humaneasy
 
Posts: 14
Joined: Sat Jul 08, 2006 4:37 pm

Postby richardk » Mon Feb 19, 2007 3:24 pm

So you want WPMU to catch all sub domains that don't have a directory in /subsites?

Code: Select all
Options +FollowSymLinks

<IfModule mod_rewrite.c>
  RewriteEngine On

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

  RewriteRule ^(stats(/.*)?|failed_auth\.html)$ - [NC,L]

  RewriteCond %{HTTP_HOST} ^([^\.]+)\.healthblogs.org$ [NC]
  RewriteCond %{DOCUMENT_ROOT}/subsites/%1%{REQUEST_URI}/ -d
  RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

  RewriteCond %{ENV:REDIRECT_STATUS} ^$
  RewriteCond %{HTTP_HOST} ^([^\.]+)\.healthblogs.org$ [NC]
  RewriteCond %{DOCUMENT_ROOT}/subsites/%1/ -d
  RewriteRule ^(.*)$ /subsites/%1/$1 [QSA,L]

  RewriteCond %{ENV:REDIRECT_STATUS} ^$
  RewriteCond %{REQUEST_URI} ^/([^/]+)(/(.*))?$
  RewriteCond %{DOCUMENT_ROOT}/subsites/%1/ -d
  RewriteRule .* http://%1.healthblogs.org/%3 [R=301,L]

  RewriteRule ^(.*/)?files/(.*)$ /wp-content/blogs.php?file=$2 [L]

  RewriteCond %{ENV:REDIRECT_STATUS} !^$ [OR]
  RewriteCond %{SCRIPT_FILENAME} -f [OR]
  RewriteCond %{SCRIPT_FILENAME} -d
  RewriteRule . - [L]

  RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*|.*\.php)$ $2 [L]
  RewriteRule . index.php [L]
</IfModule>
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 35 guests

cron