2

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

http://www.iis.net/learn/extensions/url-rewrite-module/user-friendly-url-rule-template

When inputting:

www.domain.com/index.php/url-title

i only get this option for public url:

www.domain.com/index

No good :)

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

1 Answer 1

4

Try

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
 <rewrite>
    <rules>
      <rule name="Rewriter" stopProcessing="true">
        <match url="^(.*)$" ignoreCase="false" />
        <conditions>
          <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" />
        </conditions>
        <action type="Rewrite" url="./index.php/{R:1}" appendQueryString="true" />
      </rule>
    </rules>
  </rewrite>
 </system.webServer>
</configuration> 

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).

4
  • 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 Jan 18, 2013 at 20:20
  • Hi Steven. Sorry for the delay on this one. I got this solution working! Thanks a lot. Feb 15, 2013 at 9:56
  • Thank you very much. I have researched many documents. And you save me. Thank you again.
    – user3886
    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. Aug 16, 2021 at 23:24

Your Answer

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

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