- cannot manually edit applicationhost.config
- must declare the scalar variable
- classic asp and access not working on windows 2008 64bit
- asp.net page titles are blank
- sql to get totals for last six months
- white space being counted as a node
- cross page posting not working
- collection is read only exception
- PayPal sending incorrect carrier information
- paypal guest user notice
- classic asp dictionary not working
- IE8 not supporting innerHTML
- differences between jet and odbc
- sugarcrm not inserting email
- select random records from access
- button click event firing twice
- how to send an email using cdosys
- installing perl on win2003 64 bit
- asp.net page event order
- rewrite rule for subdomains only
- extra items in javascript array
- IE7 margin auto not working
- IE7 border style dotted glitch
- ByRef and ByVal in vbscript
- weather rss feed
- Classic asp crib sheet
- Firefox onsubmit image change
- limit records in access
- AccessDataSource is thick
- double margins in IE6
- extra image padding in html emails
- decimal places in linux flash player
- broken emails in outlook 2007
- double spaced IE list items
- cannot remove movieclip
articles:
rewrite rule for subdomains only
I recently encountered a situation where I wanted a rewrite rule for isapi rewrite that would rewrite all subdomain urls, but leave the main www domain alone.
So for example:
test.domain.com
would be rewritten to
domain.com/?param=test
something.domain.com
would be rewritten to
domain.com/?param=something
But www.domain.com won't be rewritten at all.
After many desk-head based collisions I finally got it working: here's the rewrite rule you need to match subdomains as the hosts you are interested in, and not www:
RewriteCond Host: ^((?:(?!www).)*)\.domain\.com
Here's the explanation of how it works:
| ^ | # Start at the beginning of the string |
| ( | # Capture |
| (?: | # Complex expression: |
| (?!www) | # make sure we're not at the beginning of www |
| . | # accept any character |
| )* | # any number of times |
| ) | # End capture |
| \.domain\.com | # and ending at .domain.com |
Comments
Posted on 24 July 2011 01:25:00 GMT by Paul T.
Thanks! I was close but you had just what I was looking for!
Post a comment
