Web.config для сайта на WordPress

В этой статье привожу правильный Web.config  файл для корректной работы WordPress под управлением веб-сервера IIS  (Internet Information Services)  с возможностью использования красивых УРЛей (ЧПУ). Кроме файла, в IIS нужно добавить фичу URL Rewrite, а в корне созданного на WordPress сайта вставить в файл Web.config ниже приведенное содержимое.

Долго провозившись с настройкой правил для работы Rewrite в IIS, выкладываю готовый файл Web.config, чтоб больше не возвращаться к этому вопросу.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <directoryBrowse enabled="false"/>
    <defaultDocument>
      <files>
        <clear/>
        <add value="index.php"/>
        <add value="Default.htm"/>
        <add value="Default.asp"/>
        <add value="index.htm"/>
        <add value="Default.aspx"/>
      </files>
    </defaultDocument>
    <rewrite>
      <rules><rule name="Main Rule" stopProcessing="true"><match url=".*"/><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/{R:0}"/></rule>
			<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>
  </system.webServer>
</configuration>

 


Комментариев нет »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment






MarkiMarta.ru. Записки отца-программиста" с 2009 г.
Категория информационной продукции 18+
Яндекс.Метрика