Does anyone have experience doing this on a windows server, running IIS7?

I've got access to the IIS manager, and the URL Rewrite module, but how to setup the rewrite rules, and how should the patterns look?

Ive tried this example, but the auto-generated examples of public url's are no good


When inputting:


i only get this option for public url:


No good :)

So i need to make a blank rule, but have no clue how to create the pattern.

1 Answer 1



<?xml version="1.0" encoding="UTF-8"?>
      <rule name="Rewriter" stopProcessing="true">
        <match url="^(.*)$" ignoreCase="false" />
          <add input="{R:1}" pattern="^(index\\.php|images|css|js|favicon\\.ico)" ignoreCase="false" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
        <action type="Rewrite" url="./index.php/{R:1}" appendQueryString="true" />

if you were using an older IIS version with the ISAPI rewrite module then you could do

 RewriteEngine on 
    RewriteCond $1 !^(css|js|swf|images|system|tools|themes|index\.php) [NC]
    RewriteRule ^(.*)$ /index.php/$1 [L]

where the RewriteCond piped lines are equal to the folders that you don't want to be rewritten.

Certainly this worked on an older IIS version (I now try to avoid IIS where possible).

  • realised that the above was when we had ISAPI Rewrite installed via IIS. With newer IIS7 you should have a web.config file. Update the post above Commented Jan 18, 2013 at 20:20
  • Hi Steven. Sorry for the delay on this one. I got this solution working! Thanks a lot. Commented Feb 15, 2013 at 9:56
  • Thank you very much. I have researched many documents. And you save me. Thank you again.
    – user3886
    Commented Dec 17, 2014 at 3:27
  • @MichaelRasmussen Please share your solution if it's different from the one given, if possible given the time. It could help someone else. Commented Aug 16, 2021 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.