What is the IIS equivalent of these rewrite rules?

I have always used apache, so I am completely new to IIS. How do I do this in IIS?

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

I have IIS Manager open, and I look at "URL Rewrite" and just click on "Add Rule". I guess this is where I want to be, but I don’t know where to go from here.


For those of you who know IIS but not apache mod_rewrite, it just checks to see if the request is NOT a directory or file, and if so, it takes the URL of the request and passes it to index.php as a GET parameter that it can be processed in code using a router.

+3
source share
2 answers

, " URL", " ..." . / "", web.config.

web.config (, /system.webServer... ..):

<rewrite>  
  <rules>  
    <rule name="Imported Rule 1" stopProcessing="true">  
      <match url="^(.*)$" ignoreCase="false" />  
      <conditions>  
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />  
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />  
      </conditions>  
      <action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />  
    </rule>  
  </rules>  
</rewrite>  

, : http://learn.iis.net/page.aspx/470/importing-apache-modrewrite-rules/

+10

htaccess , Zend Framework. , IIS 7.0.

+1

Source: https://habr.com/ru/post/1778687/


All Articles