Назад | Перейти на главную страницу

Правило перезаписи Apache в iis

Я пытаюсь переместить сайт с apache на iis 8.5

Все в порядке, но 1 правило не позволяет моему сайту нормально работать

RewriteCond %{REQUEST_URI} !\.(js|css|jpg|jpeg|gif|png)$ [or]
RewriteCond %{REQUEST_URI} apple-touch-icon\.png$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]

Может кто нибудь перевести в IIS переписать?

Я нашел несколько примеров для этого

<rule name="Webasyst Controller" stopProcessing="true">
    <match url="^(.*)$" ignoreCase="false" />
    <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{URL}" pattern="!\.(eot|ttf|woff|js|css|jpg|jpeg|gif|png)$" negate="true" />
        <add input="{URL}" pattern="apple-touch-icon\.png$" negate="true" />
    </conditions>
    <action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>

и

<rule name="Webasyst Controller" stopProcessing="true">
    <match url="[^eot|ttf|woff|js|css|jpg|jpeg|gif|png]$|apple\-touch\-icon\.png$" ignoreCase="false" />
    <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>

Оба они не работают

Может кто поможет?

Основываясь на втором примере в вашем вопросе:

<rule name="Webasyst Controller" stopProcessing="true">
    <match url="(\.(?!eot|ttf|woff|js|css|jpe?g|gif|png)|apple\-touch\-icon\.png)$" ignoreCase="false" />
    <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>