You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by The_RadiX <th...@the-spectrum.org> on 2002/07/05 17:13:46 UTC

[Apache] Catchall Subdomain Method?..

Below is an extract of my current .htaccess (main /htdocs dir) file:


DirectoryIndex index.php index.php3 index.html index.htm

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} a.wwwname.org
RewriteCond %{REQUEST_URI} !a/
RewriteRule ^(.*)$ subs/a/$1 [L]
RewriteCond %{HTTP_HOST} b.wwwname.org
RewriteCond %{REQUEST_URI} !b/
RewriteRule ^(.*)$ subs/b/$1 [L]
RewriteCond %{HTTP_HOST} mysqladmin.wwwname.org
RewriteCond %{REQUEST_URI} !mysqladmin/
RewriteRule ^(.*)$ mysqladmin/$1 [L]
RewriteCond %{HTTP_HOST} uploads.wwwname.org
RewriteCond %{REQUEST_URI} !uploads/
RewriteRule ^(.*)$ uploads/$1 [L]
RewriteCond %{HTTP_HOST} webdev.wwwname.org
RewriteCond %{REQUEST_URI} !subs/webdev/
RewriteRule ^(.*)$ subs/webdev/$1 [L]
RewriteCond %{HTTP_HOST} c.wwwname.org
RewriteCond %{REQUEST_URI} !subs/webdev/c/
RewriteRule ^(.*)$ subs/webdev/c/$1 [L]



(note: I have changed real names for privacy. FYI)


Now the thing is as you can see this is getting a little messy..

and if I intend to add many more little handy subdomain's well it will become harder to manage..



I'd just like to know if there is a simpler way of doing this??


I have played with RegEx strings for a while with it but it never seems to work how I want...


Ie.. I have tried using like ([A-Za-z0-9\-]+).wwwname.org and making that goto /subs/%1 etc..

didn't really work though..




Thanks for any help people..
:::::::::::::::::::::::::::::::::::::::::::
:  Julien Bonastre [The-Spectrum.org CEO]
:  A.K.A. The_RadiX
:  the_radix@the-spectrum.org
:  ABN: 64 235 749 494
:  QUT Student #: 04475739
:::::::::::::::::::::::::::::::::::::::::::