# Catching all subdomains on a Apache/WinXP

**URL:** <https://forum.kirupa.com/t/catching-all-subdomains-on-a-apache-winxp/61421>\
**Category:** programming\
**Created:** [August 18, 2004, 1:44pm UTC](https://forum.kirupa.com/t/catching-all-subdomains-on-a-apache-winxp/61421 "2004-08-18T13:44:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aeonmarky](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@aeonmarky](https://forum.kirupa.com/u/aeonmarky)\
**Post date:** [August 18, 2004, 1:44pm UTC](https://forum.kirupa.com/t/catching-all-subdomains-on-a-apache-winxp/61421/1 "2004-08-18T13:44:03Z")

</div>

Hello guys

Heres my problem

I want to catch all subdomains on my local domain name…

e.g. [www.test.com](http://www.test.com)

and i want to catch all subdomains… before the .testing.com…

e.g. [1.test.com](http://1.test.com), [2.test.com](http://2.test.com), [sdffs.test.com](http://sdffs.test.com)

without having fix on the winnt/system32/drivers/etc/host

Here what ive done

first, i created a virtual host on my apache httpd.conf

here it is,

\<VirtualHost [test.com](http://test.com)\>  
ServerAdmin [webmaster@dummy-host.example.com](mailto:webmaster@dummy-host.example.com)  
DocumentRoot c:/apache/htdocs/test/  
\*\* ServerName \*_[**www.test.com**](http://www.test.com)  
\*\* ServerAlias [test.com](http://test.com) .test.com_  
ErrorLog logs/dummy-host.example.com-error\_log  
CustomLog logs/dummy-host.example.com-access\_log common  
\</VirtualHost\>

and on my winnt/system32/drivers/etc/host file

127.0.0.1 [test.com](http://test.com) [www.test.com](http://www.test.com)

and on my .htaccess using a mod\_rewrite

RewriteEngine on  
RewriteCond %{HTTP\_HOST} ^([a-z0-9]+)…+…_$ [NC]  
RewriteCond /apache/htdocs/test/%1 !-d  
RewriteCond /apache/htdocs/test/%1 !-l  
RewriteRule ^(_.)$ [www.test.com](http://www.test.com) [L,NS]

Finally i got the result when i type [http://www.test.com](http://www.test.com) on my browser

is SERVER ERROR or misconfigution…

Please help… im really getting frustrated with this one. 🙂 thanks!

Thanks for advance help… 🙂
