Windows2012 R2下IIS8.5偽靜態規則設定(WordPress執行個體)

來源:互聯網
上載者:User

說明:

作業系統:Windows Server 2012 R2

Web伺服器:IIS 8.5

網站程式:WordPress

網站根目錄:C:inetpubwwwroot

網站網域名稱:www.111cn.net

實現目的:

配置WordPress偽靜態

具體操作:

一、確認IIS 8.5是否安裝IIS URL Rewrite

開啟:控制台系統和安全管理工具Internet Information Services (IIS)管理器

看到URL重寫,說明已經安裝了IS URL Rewrite,否則要先安裝此外掛程式。

IIS URL Rewrite下載:http://download.microsoft.com/download/4/E/7/4E7ECE9A-DF55-4F90-A354-B497072BDE0A/rewrite_x64_zh-CN.msi 

雙擊預設安裝即可

二、添加IIS 8.5偽靜態規則檔案

1、建立web.config檔案,添加以下代碼,儲存

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name="category">

<match url="category/?(.*)" />

<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />

<action type="Rewrite" url="/index.php?category_name={R:1}" appendQueryString="false" logRewrittenUrl="false" />

</rule>

<rule name="tags">

<match url="tag/?(.*)" />

<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />

<action type="Rewrite" url="index.php?tag={R:1}" />

</rule>

<rule name="Main Rule" stopProcessing="true">

<match url=".*" />

<conditions logicalGrouping="MatchAll" trackAllCaptures="false">

<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 logicalGrouping="MatchAll" trackAllCaptures="false">

<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>

2、把web.config拷貝到網站根目錄:C:inetpubwwwroot下

三、設定WordPress

進入網站管理後台

設定-固定連結-自訂結構

填寫:/archives/%post_id%.html

儲存

系統營運  www.111cn.net  溫馨提醒:qihang01原創內容 著作權,轉載請註明出處及原文連結

如下圖所示

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.