Windows+IIS下WordPress伪静态规则(二)

此次发布的伪静态,实现URL例如本文:https://yangjunwei.com/484.html

Wordpress后台固定链接设置 - 自定义结构:/a/%post_id%.html

此规则中的 a 可以自定义为其它目录,只需修改代码中的 a 即可!

##

##  伪静态URL:https://yangjunwei.com/484.html

##

##  固定链接设置 - 自定义结构:/a/%post_id%.html

##

[ISAPI_Rewrite]

RewriteRule /a/tag/(.*) /index\.php\?tag=$1

RewriteRule /tag/(.*) /index\.php\?tag=$1

RewriteRule /(about|link|tags|sitemap) /index\.php\?pagename=$1

RewriteRule /a/category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?category_name=$1&feed=$2

RewriteRule /a/category/?(.*) /index\.php\?category_name=$1

RewriteRule /author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?author_name=$1&feed=$2

RewriteRule /author/?(.*) /index\.php\?author_name=$1

RewriteRule /feed /index\.php/\?feed=rss2

RewriteRule /rss.xml /index\.php/\?feed=rss2

RewriteRule /comments/feed /index\.php/\?feed=comments-rss2

RewriteRule /([0-9]+)/?([0-9]+)?/?$ /index\.php\?p=$1&page=$2

RewriteRule /a/([0-9]+)/?([0-9]+)?/?$ /index\.php\?p=$1&page=$2

RewriteRule /a/([0-9]+).html /index\.php\?p=$1 [I]

RewriteRule /page/(.*)/?s=(.*) /index\.php\?s=$2&paged=$1

RewriteRule /page/(.*) /index\.php\?paged=$1

RewriteRule /a/date/([0-9]{4})([0-9]{1,2})([0-9]{1,2})/([^/]+)/?([0-9]+)?/?$ /index\.php\?year=$1&monthnum=$2&day=$3&name=$4&page=$5

RewriteRule /a/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&day=$3&page=$4

RewriteRule /a/date/([0-9]{4})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&page=$3

RewriteRule /a/([0-9]+).html/(feed|rdf|rss|rss2|atom) /index\.php\?feed=rss2&p=$1

RewriteRule /a/([0-9]+).html/trackback /wp-trackback\.php\?p=$1

# For file-based wordpress content (i.e. theme), admin, etc.

RewriteRule /wp-(.*) /wp-$1 [L]