subdomain problem

Feb 4, 2009 at 5:05 AM
my IsapiRewrite4.ini is

RewriteCond %{HTTP_HOST} ^(?!www)([^.]+)\.dinoch\.net
RewriteRule ^/list.aspx$ /member/list.aspx?username=%1 [I,L,U]
RewriteRule ^/post.aspx$ /member/post.aspx?username=%1 [I,L,U]
RewriteRule ^/(.*)$ /member/Default.aspx?username=%1 [I,L,U]

When I visit,Request.QueryString["username"] is test.
It is good.
When I visit,Request.QueryString["username"] is %1.
It is bad,I want get test

Feb 9, 2009 at 7:43 PM
As far as I know, the RewriteCond lines only apply to the next RewriteRule and not to all remaining rules. There may be a way to apply a condition to all subsequent rules, but the only method I have to do what you are doing is to copy the RewriteCond to preceed each RewriteRule. It isn't pretty so you may want to keep looking, but it does seem to work. The sure way to see a rule not working is when placeholders appear as static text (e.g., "%1" instead of a value for that variable). This rewrite implementation doesn't blank out empty variables (i.e., %x or $x variables).

On the alternate side of that, if you want multiple RewriteConds to apply to a single RewriteRule, you can stack them up just fine.