WordPress在window2003 IIS ISAPI ReWrite下的URL规则

Saadiya ·
更新时间:2024-09-21
· 779 次阅读

为了便于搜索引擎抓取(换句话就是假静态),下面是URL ReWrite的规则,效果看我的chinadigger的链接地址。我目前的Rewrite规则: 
代码如下:
[ISAPI_Rewrite] 
# 3600 = 1 hour 
CacheClockRate 3600 
RepeatLimit 32 
# Protect httpd.ini and httpd.parse.errors files 
# from accessing through HTTP 
# WordPress rewrite rules# 
RewriteRule /tag/(.*)/ /index\.php\?tag=$1 
RewriteRule /(about-me|about-copyright|guest-book)/ /index\.php\?pagename=$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/?$ /wp-feed\.php/\?feed=rss2 
RewriteRule /comments/feed/?$ /wp-feed\.php/\?feed=comments-rss2 
RewriteRule /page/(.*)/ /index\.php\?paged=$1 
RewriteRule /photo/?([^/]*)?/?([^/]*)?/?([^/]*)?/?([^/]*)?/?$ /wp-content/plugins/fgallery/fim_photos\.php\?$1=$2&$3=$4 [QSA,L,I] 
RewriteRule /photo/?(.*) /wp-content/plugins/fgallery/fim_photos\.php\?$1=$2&$3=$4 [QSA,L,I] 
# /%year%%monthnum%%day%/%postname%/ 
RewriteRule /category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?category_name=$1&feed=$2 
RewriteRule /category/?(.*)/ /index\.php\?category_name=$1 
RewriteRule /([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 /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&day=$3&page=$4 
RewriteRule /([0-9]{4})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&page=$3 
RewriteRule /([0-9]{4})([0-9]{1,2})([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index\.php\?year=$1&monthn&day=$3&name=$4&feed=$5 
RewriteRule /([0-9]{4})([0-9]{1,2})([0-9]{1,2})/([^/]+)/trackback/?$ /wp-trackback\.php\?year=$1&monthnum=$2&day=$3&name=$4&tb=1 
# /post/%post_id%.html 
RewriteRule /([0-9]+)/?([0-9]+)?/?$ /index\.php\?p=$1&page=$2 
# RewriteRule /post/([0-9]+)/?([0-9]+)?/?$ /index\.php\?p=$1&page=$2 
RewriteRule /post/([0-9]+).html /index\.php\?p=$1 [I] 
RewriteRule /post/category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?category_name=$1&feed=$2 
RewriteRule /post/category/?(.*)/ /index\.php\?category_name=$1 
RewriteRule /post/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 /post/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&day=$3&page=$4 
RewriteRule /post/date/([0-9]{4})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&page=$3 


使用方法(将Wordpres安装在根目录)
去discuz.net的论坛下载Rewrite的压缩包,然后按照安装方法在IIS里面配置好Rewrite,用上面的规则覆盖httpd.ini中原来的内容,再到wordpress的后台,将选项的永久链接部分,使用自定义,然后在框框里面填写上面粗体部分的内容(两种选一种,其中# /post/%post_id%.html还不太完善),即可。
本文引用bluefeel所写的规则。原文中TAG编写有问题,我已经更改完毕,大家要注意写法,否则会影响其他IIS站点目录。
您可能感兴趣的文章:在CentOS 6 中安装 WordPress(二)安装WordPress8个出色的WordPress SEO插件收集WordPress入门指南-wordpress安装使用说明在CentOS 6 中安装WordPress(一) 安装Apache,Mysql, PHP环境WordPress判断用户是否登录的代码wordpress主题支持自定义菜单及修改css样式实现方法WordPress导入数据库出现”Unknown collation: ‘utf8mb4_unicode_ci”错误的解决办法Nginx下让WordPress支持固定链接的伪静态规则用js代码和插件实现wordpress雪花飘落效果的四种方法PHP版本升级到7.x后wordpress的一些修改及wordpress技巧修改WordPress中文章编辑器的样式的方法详解WordPress 照片lightbox效果的运用几点在CentOS系统上从零开始搭建WordPress博客的全流程记录基于wordpress主题制作的具体实现步骤解决安装wordpress时出现ERR_TOO_MANY_REDIRECTS重定向次数过多问题



rewrite IIS WordPress url

需要 登录 后方可回复, 如果你还没有账号请 注册新账号
相关文章
Hedva 2020-12-01
716