Rewrite without redirect

Topics: Developer Forum
Oct 24, 2011 at 11:45 AM

I am trying to rewrite without redirecting on IIS 6, IIRF 2.1, WIn 2K3 with the following rule for the domain

  RewriteBase /
  RewriteRule ^abc/def/$ [NC]

This does not work although my redirect rules work fine.  If I use:
   RewriteRule ^abc/def/$ [NC, R=301]

it redirects to as expected

What I want is that when the user types in that it still shows that url (does not redirect) in the address bar but displays the content at
just like it would work on Apache.

In other words the pretty url is displayed in the address bar but the full url (with query string) content is displayed on the page.
How do I do this?



Oct 24, 2011 at 6:09 PM

The replacement text for RewriteRule must specify a new URL path and query string.
It must not specify the protocol(scheme), server and port.

So, you must use

  RewriteRule ^abc/def/$    abc/xyz.php?x=123 [NC]

If you looked in the IIRF log, or checked the IIRF status page (http://server/iirfstatus), you would have seen a warning about this. (And, If you had read the documentation for IIRF, you would have seen the recommendation to look at the IIRF status page!)

One more tip: you should not specify a path for RewriteBase, unless you have a very good reason to do so.  If you want RewriteBase in IIRF, just use:


Good luck.

Oct 24, 2011 at 7:30 PM

Thanks Cheeso!  That did the trick. It worked even with RewriteBase /


Much appreciated.



Oct 24, 2011 at 9:52 PM

Glad it helped.

I know that it will work with RewriteBase /, but it is a bad idea to put that in there, unless you need it. 

It's like running with scissors.  Mostly you won't fall, stab yourself, and die.  Sometimes you will, though. So don't do it.