Create subdomain from subdirectory

Sep 20, 2010 at 4:31 PM

As requested, on a new thread:

I need to set up a rewrite rule that automatically takes whatever is typed in as the subdomain and rewrites it as a subdirectory. IT set up the URL for our testing server as a subdomain already: test.ourdomain.edu. So, even though it's annoying, I can develop the site using sub-subdomains like "academics.test.ourdomain.edu." I am VERY fuzzy with regular expressions, but I thought I had adapted it properly with the following code:

 

#REDIRECT SUBDOMAIN TO SUBDIRECTORY OF SAME NAME
CondSubstringBackrefFlag %
RewriteCond %{HTTP_HOST} ^(?!www)([^.]+)\.test\.ourdomain\.edu
RewriteRule ^/(.*)$ /%1/$1 [L] 

 

In short, I want "academics.test.ourdomain.edu" to be rewritten to "test.ourdomain.edu/academics".

What ends up happening is that it keeps rewriting to "test.ourdomain.edu".

Here is the contents of the logfile:

Fri Sep 10 09:23:45 -  2296 - -------------------------------------------------------
Fri Sep 10 09:23:45 -  2296 - Ionic ISAPI Rewriting Filter (IIRF) 2.1.1.23 x86 RELEASE
Fri Sep 10 09:23:45 -  2296 - IIRF was built on: May 30 2010 13:26:57
Fri Sep 10 09:23:45 -  2296 - Cached: DLL_PROCESS_ATTACH
Fri Sep 10 09:23:45 -  2296 - Cached: Process ID: 1700
Fri Sep 10 09:23:45 -  2296 - Cached: ReadServerConfig: C:\Program Files\Ionic Shade\IIRF 2.1\IirfGlobal.ini(23): Filter Priority is now: HIGH (0x80000)
Fri Sep 10 09:23:45 -  2296 - Cached: ReadServerConfig: C:\Program Files\Ionic Shade\IIRF 2.1\IirfGlobal.ini(46): NotifyLog setting is now: OFF
Fri Sep 10 09:23:45 -  2296 - Cached: ReadServerConfig: C:\Program Files\Ionic Shade\IIRF 2.1\IirfGlobal.ini(63): RewriteEngine setting is now: ON
Fri Sep 10 09:23:45 -  2296 - Cached: DLL_PROCESS_ATTACH - complete
Fri Sep 10 09:23:45 -  2296 - Cached: GetFilterVersion
Fri Sep 10 09:23:45 -  2296 - GetLogFile: app:'/LM/W3SVC/998577302/Root'  new log:'c:\temp\iirf.1700.log'
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: actual log file 'c:\temp\iirf.1700.log'
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: ini file: 'C:\Inetpub\wwwroot\Iirf.ini'
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: ini file timestamp: 2010/09/10 09:23:12 Central Daylight Time
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: cfg(0x01CB3F10)
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: LogLevel = 3
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: C:\Inetpub\wwwroot\Iirf.ini(13): RewriteEngine will be enabled.
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: C:\Inetpub\wwwroot\Iirf.ini(16): RewriteBase will be '/'
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: C:\Inetpub\wwwroot\Iirf.ini(42): RewriteCond   %{REQUEST_FILENAME}  !-f '(null)'
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: C:\Inetpub\wwwroot\Iirf.ini(43): RewriteCond   %{REQUEST_FILENAME}  !-d '(null)'
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: C:\Inetpub\wwwroot\Iirf.ini(44): RewriteRule (rule 1)  '^(.*)$'  'index.php?q=$1'  [L,QSA]
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: C:\Inetpub\wwwroot\Iirf.ini(47): CondSubstringBackrefFlag %
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: C:\Inetpub\wwwroot\Iirf.ini(48): RewriteCond   %{HTTP_HOST}  ^(?!www)([^.]+)\.test\.ourdomain\.edu '(null)'
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: C:\Inetpub\wwwroot\Iirf.ini(49): RewriteRule (rule 2)  '^/(.*)$'  '/%1/$1'      [L]
Fri Sep 10 09:23:45 -  2296 - ReadVdirConfig: Done reading INI for the root vdir, found 2 rules (0 errors, 0 warnings) on 101 lines
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: cfg= 0x01CB3F10
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Sep 10 09:23:45 -  2296 - DoRewrites
Fri Sep 10 09:23:45 -  2296 - DoRewrites: Url (no decoding): '/'
Fri Sep 10 09:23:45 -  2296 - EvaluateRules: depth=0
Fri Sep 10 09:23:45 -  2296 - EvaluateRules: stripping URL base, new subject: ()
Fri Sep 10 09:23:45 -  2296 - EvaluateRules: Rule 1: 2 match
Fri Sep 10 09:23:45 -  2296 - EvaluateRules: Rule 1: evaluating condition
Fri Sep 10 09:23:45 -  2296 - EvalCondition: Cond t(%{REQUEST_FILENAME}) op(f) p(!-f) => TRUE
Fri Sep 10 09:23:45 -  2296 - EvalCondition: Cond t(%{REQUEST_FILENAME}) op(d) p(!-d) => FALSE
Fri Sep 10 09:23:45 -  2296 - EvalConditionList: rule 1, FALSE, Rule does not apply
Fri Sep 10 09:23:45 -  2296 - EvaluateRules: Rule 2: -1 (No match)
Fri Sep 10 09:23:45 -  2296 - EvaluateRules: returning 0
Fri Sep 10 09:23:45 -  2296 - DoRewrites: No Rewrite
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: cfg= 0x01CB3F10
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: cfg= 0x01CB3F10
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: cfg= 0x01CB3F10
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Sep 10 09:23:45 -  2296 - HttpFilterProc: cfg= 0x01CB3F10

Any help would be appreciated. Thanks!