URL переписать IIS и Wordpress - PullRequest
0 голосов
/ 27 июня 2018

У меня есть следующий web.conf

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="wordpress" patternSyntax="Wildcard">
            <match url="*" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
            <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />
                <add value="default.aspx" />
            </files>
        </defaultDocument>

  </system.webServer>
</configuration>

Сайт WordPress работает, однако на некоторых изображениях появляется следующая ошибка, если я просматриваю пример изображения http://domain/wp-content/uploads/2018/06/home-slide-5.jpg

Ошибка HTTP 500.50 - Ошибка модуля перезаписи URL. Невозможно отобразить страницу из-за внутренней ошибки сервера.

1 Ответ

0 голосов
/ 27 июня 2018

Я добавил следующее в правила, теперь оно работает

<rule name="Imported Rule 1" stopProcessing="true">
    <match url="^index\.php$" ignoreCase="false"/>
    <action type="None"/>
</rule>

<rule name="Redirect Image to HTTP" stopProcessing="true">
    <match url=".*\.(gif|jpg|jpeg|png|css|js)$" ignoreCase="true"/>
    <action type="Rewrite" url="{R:0}"/>
</rule>

<rule name="Imported Rule 2" stopProcessing="true">
    <match url="." ignoreCase="false"/>
    <conditions>
        <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"/>
</rule>

КРЕДИТЫ: Постоянная ссылка Wordpress на IIS?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...