LEARN

How to Setup WordPress Permalinks on Windows IIS 

28/02/2018

Permalinks without mod_rewrite

How to Setup WordPress Permalinks on Windows IIS    Place this file into the base directory of your WordPress installation to allow permalinks (or “pretty URLs”) on Windows IIS.

“Pretty” permalinks usually require mod_rewrite, and IIS (common on Windows servers) does not support mod_rewrite. (If you are using Apache 2.0.54, on Windows, mod_rewrite may work, provided it is enabled in apache\conf\httpd.conf.)

If you are using IIS 7 and have admin rights on your server, you can use Microsoft’s URL Rewrite Module instead. Though not completely compatible with mod_rewrite, it does support WordPress’s pretty permalinks. Once installed, open the web.config file in the WordPress folder and add the following rule to the system.webServer element

ใส่ค่า config ด้านล่างไว้ในไฟล web.config ใน folder ของ WordPress

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="wordpress" 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" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

ศึกษาเพิ่มเติมที่ Codex

 

No Comments

Leave a Reply