wordpress默认伪静态规则

来自版本5.9.2,在当前主题下functions.php中添加如下代码:

add_filter('rewrite_rules_array','show_rewrite_rules');
function show_rewrite_rules($rules){
  echo nl2br(var_export($rules,true));
  die;
}

访问wp-admin/options-permalink.php即可打印伪静态规则

array (
'^wp-json/?$' => 'index.php?rest_route=/',
'^wp-json/(.*)?' => 'index.php?rest_route=/$matches[1]',
'^index.php/wp-json/?$' => 'index.php?rest_route=/',
'^index.php/wp-json/(.*)?' => 'index.php?rest_route=/$matches[1]',
'^wp-sitemap\\.xml$' => 'index.php?sitemap=index',
'^wp-sitemap\\.xsl$' => 'index.php?sitemap-stylesheet=sitemap',
'^wp-sitemap-index\\.xsl$' => 'index.php?sitemap-stylesheet=index',
'^wp-sitemap-([a-z]+?)-([a-z\\d_-]+?)-(\\d+?)\\.xml$' => 'index.php?sitemap=$matches[1]&sitemap-subtype=$matches[2]&paged=$matches[3]',
'^wp-sitemap-([a-z]+?)-(\\d+?)\\.xml$' => 'index.php?sitemap=$matches[1]&paged=$matches[2]',
'./(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
'./(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
'./(.+?)/embed/?$' => 'index.php?category_name=$matches[1]&embed=true',
'./(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
'./(.+?)/?$' => 'index.php?category_name=$matches[1]',
'tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
'tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
'tag/([^/]+)/embed/?$' => 'index.php?tag=$matches[1]&embed=true',
'tag/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]',
'tag/([^/]+)/?$' => 'index.php?tag=$matches[1]',
'type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_format=$matches[1]&feed=$matches[2]',
'type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_format=$matches[1]&feed=$matches[2]',
'type/([^/]+)/embed/?$' => 'index.php?post_format=$matches[1]&embed=true',
'type/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?post_format=$matches[1]&paged=$matches[2]',
'type/([^/]+)/?$' => 'index.php?post_format=$matches[1]',
'robots\\.txt$' => 'index.php?robots=1',
'favicon\\.ico$' => 'index.php?favicon=1',
'.*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\\.php$' => 'index.php?feed=old',
'.*wp-app\\.php(/.*)?$' => 'index.php?error=403',
'.*wp-register.php$' => 'index.php?register=true',
'feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
'(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
'embed/?$' => 'index.php?&embed=true',
'page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
'comments/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
'comments/embed/?$' => 'index.php?&embed=true',
'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
'search/(.+)/embed/?$' => 'index.php?s=$matches[1]&embed=true',
'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]',
'search/(.+)/?$' => 'index.php?s=$matches[1]',
'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
'author/([^/]+)/embed/?$' => 'index.php?author_name=$matches[1]&embed=true',
'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
'date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
'date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
'date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/embed/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&embed=true',
'date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]',
'date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
'date/([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
'date/([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
'date/([0-9]{4})/([0-9]{1,2})/embed/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&embed=true',
'date/([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]',
'date/([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]',
'date/([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
'date/([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
'date/([0-9]{4})/embed/?$' => 'index.php?year=$matches[1]&embed=true',
'date/([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]',
'date/([0-9]{4})/?$' => 'index.php?year=$matches[1]',
'.?.+?/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
'.?.+?/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
'.?.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
'.?.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
'.?.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?attachment=$matches[1]&cpage=$matches[2]',
'.?.+?/attachment/([^/]+)/embed/?$' => 'index.php?attachment=$matches[1]&embed=true',
'(.?.+?)/embed/?$' => 'index.php?pagename=$matches[1]&embed=true',
'(.?.+?)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1',
'(.?.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]',
'(.?.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]',
'(.?.+?)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]',
'(.?.+?)/comment-page-([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&cpage=$matches[2]',
'(.?.+?)(?:/([0-9]+))?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]',
'.+?/[0-9]+.html/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
'.+?/[0-9]+.html/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
'.+?/[0-9]+.html/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
'.+?/[0-9]+.html/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
'.+?/[0-9]+.html/attachment/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?attachment=$matches[1]&cpage=$matches[2]',
'.+?/[0-9]+.html/attachment/([^/]+)/embed/?$' => 'index.php?attachment=$matches[1]&embed=true',
'(.+?)/([0-9]+).html/embed/?$' => 'index.php?category_name=$matches[1]&p=$matches[2]&embed=true',
'(.+?)/([0-9]+).html/trackback/?$' => 'index.php?category_name=$matches[1]&p=$matches[2]&tb=1',
'(.+?)/([0-9]+).html/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&p=$matches[2]&feed=$matches[3]',
'(.+?)/([0-9]+).html/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&p=$matches[2]&feed=$matches[3]',
'(.+?)/([0-9]+).html/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&p=$matches[2]&paged=$matches[3]',
'(.+?)/([0-9]+).html/comment-page-([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&p=$matches[2]&cpage=$matches[3]',
'(.+?)/([0-9]+).html(?:/([0-9]+))?/?$' => 'index.php?category_name=$matches[1]&p=$matches[2]&page=$matches[3]',
'.+?/[0-9]+.html/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
'.+?/[0-9]+.html/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
'.+?/[0-9]+.html/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
'.+?/[0-9]+.html/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
'.+?/[0-9]+.html/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?attachment=$matches[1]&cpage=$matches[2]',
'.+?/[0-9]+.html/([^/]+)/embed/?$' => 'index.php?attachment=$matches[1]&embed=true',
'(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
'(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
'(.+?)/embed/?$' => 'index.php?category_name=$matches[1]&embed=true',
'(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
'(.+?)/comment-page-([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&cpage=$matches[2]',
'(.+?)/?$' => 'index.php?category_name=$matches[1]',
)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值