WordPress用Windows主机设置伪静态方法

时间:2022-05-02
本文章向大家介绍WordPress用Windows主机设置伪静态方法,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

WordPress本身是p?的形式,应该大多数都还是会选择自定义链接吧。

下面是windows主机的伪静态规则,因为我服务器是windows的。。。 [ISAPI_Rewrite] # Defend your computer from some worm attacks #RewriteRule .*(?:global.asa|default.ida|root.exe|..).* . [F,I,O] # 3600 = 1 hour

CacheClockRate 3600 RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files # from accessing through HTTP # Rules to ensure that normal content gets through

RewriteRule /tag/(.*) /index.php?tag=$1 RewriteRule /software-files/(.*) /software-files/$1 [L] RewriteRule /images/(.*) /images/$1 [L] RewriteRule /sitemap.xml /sitemap.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] 保存为httpd.ini,将文件上传到你的WordPress安装目录,然后设置固定链接。网上一大批的规则,随便找下就有。 通常我们自定义URL形式为: 域名/分类别名/文章ID.html

如果这样就选择自定义结构选项,填写:

/%category%/%post_id%.html 我是直接用的/%post_id%.html,我喜欢简洁。

也可以自己搭配,你觉得喜欢就行,当然得合理:

%year%:文章发表的年份,四位数字,如2014

%monthnum%:文章发表的月份,如09

%day%:文章发表的日期,如13

%hour%:文章发表的时间(小时),如10

%minute%:文章发表的时间(分钟),如01

%second%:文章发表的时间(秒),如46

%postname%:文章别名,在发表文章时可以设置。

%post_id%:文章的ID,如154

%category%:分类别名,在添加分类时可以设置。

%tag%:标签的别名,在添加标签时可以设置。 具体可以参考WordPress的设置说明。 PS:在Windows主机下设置WordPress伪静态有时会遇到一些小问题问题,所以很多人推荐WordPress搭建网站最好选用Linux主机。 我用的windows服务器,各有各的好处吧,毕竟我网站全是用的windows服务器。