Simple rule

Topics: Developer Forum, Project Management Forum, User Forum
Oct 4, 2008 at 5:07 AM
This is work fine with ISAPI_Rewrite
RewriteCond  Host:    (?!www)([^.]+)\.5chem\.com:8001
RewriteRule  / /blog/defaultdiv.aspx?id=$1 [I,L,U]


But It doesnt work.
 
RewriteCond %{HTTP_HOST}          ([^\.]+)\.5chem\.com:8001$  [I]             
RewriteRule / /blog/defaultdiv.aspx?id=$1        [I,L,U]

please help me!!
thanks
Coordinator
Oct 4, 2008 at 11:30 PM
Edited Oct 4, 2008 at 11:30 PM

HTTP_HOST is the hostname, without the port.  the 8001 will never show up in HTTP_HOST, in IIRF.

if you want to query on the port, you need to look at %{SERVER_PORT}.

Also, the $1 in the replacement pattern - do you mean for that to refer to the hostname match?  In other words the thing that came before 5chem ?  In that case you need a %1.  (or *1 in v2.0)

Hence, 

RewriteCond %{SERVER_PORT}      ^8001$
RewriteCond %{HTTP_HOST}        ^([^\.]+)\.5chem\.com$          [I]
RewriteRule   ^/$               /blog/defaultdiv.aspx?id=%1    [I,L,U]

But I have a question for you: If you already have ISAPI_Rewrite, then why use IIRF?

Oct 5, 2008 at 5:06 AM
Edited Oct 5, 2008 at 5:24 AM
My ISAPI_Rewrite already expired.
IIRF is the best ISAPI in the open source world.
So  I wanna change my ISAPI_Rewrite to IIRF

I like it.^-^
Thank you for your reply

Coordinator
Oct 6, 2008 at 8:38 PM
Edited Oct 6, 2008 at 8:39 PM

good! I'm glad you like IIRF.

Did my suggestion work for you?