一般我们使用wordpress都会将固定链接设置成伪静态的,但是WP却只能在LINUX系统的服务器中才能很好的使用,在WINDOWS系统的IIS中设置伪静态会在前面加上index.php,所以无法实现真正的伪静态功能。
win主机下的wordpress文章的链接都是http://www.***.com/index.php/123.html类似的链,
中间的index.php异常明显
这里发菜工作室介绍一种方法
首页你的主机要装Rewrite 组件,现在国内很多WINDOWS主机都有装这个了。
使用方法:桌面新建一个txt文档然后复制下面的代码,然后修改文件名为httpd.ini并上传到网站的根目录。然后去WP后台设置固定连接:/%post_id%.html
httpd.ini 中加入如下代码:
- [ISAPI_Rewrite]
- # 3600 = 1 hour
- CacheClockRate 3600
- RepeatLim(如何打造高质量外链)it 32
- # Protect httpd.ini and httpd.parse.errors files
- # from accessing through HTTP
- # wordpress 伪静态规则
- # For tag(中文标签以及标签翻页的规则)
- RewriteRule /tag/(.*)/page/(d+)$ /index.php?tag=$1&paged=$2
- RewriteRule /tag/(.+)$ /index.php?tag=$1
- # For category(中文分类以及分类翻页的规则)
- RewriteRule /category/(.*)/page/(d+)$ /index.php?category_name=$1&paged=$2
- RewriteRule /category/(.*) /index.php?category_name=$1
- # For sitemapxml
- RewriteRule /sitemap.xml /sitemap.xml [L]
- RewriteRule /sitemap.html /sitemap.html [L]
- RewriteRule /sitemap_baidu.xml /sitemap_baidu.xml [L]
- RewriteRule /favicon.ico /favicon.ico [L]
- # For file-based wordpress content (i.e. theme), admin, etc.
- RewriteRule /wp-(.*) /wp-$1 [L]
- # For normal wordpress content, via index.php
- RewriteRule ^/$ /index.php [L]
- RewriteRule /(.*) /index.php/$1 [L]