我们都知道,静态路径比动态路径对搜索引擎更加友好,更加有利于收录,所以我们都会做伪静态。wordpress在Linux主机下可以直接设置,但是如果我们不小心选择了win主机,可能很多朋友就不知道怎么设置了,那么几天我就教大家,wordpress在win主机下怎么设置伪静态。
一:在我们的本地桌面新建一个txt的文本
二:打开文本,输入以下代码
[ISAPI_Rewrite]
# 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 /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,用ftp上传到网站根目录
四:在网站后台,选择“设置–固定链接”选择“自定义”,输入规则就完成伪静态的设置了
附伪静态规则:
/%category%/%post_id%.html2个斜杠中间的代码可以替换 (注意不要有空格,不然会多个数字)
可替换的代码如下:
%year% 年份
%monthnum% 月份
%day% 日期
%hour% 小时
%minute% 分钟
%second% 秒
%postname% 文章名 (在发表文章的时候,输入文章缩略名“Win Host wp Rewrite”那么 “win-host-wp-rewrite” 就是url中的文章名)
%post_id% 文章的ID
%category% 目录
%author% 作者
注意替换代码的时候保证代码的完整性和连续性,中间不要有空格和其他非代码字符否则会造成404错误。
如果大家还有什么不明白的可以给我留言,页可以加我的
评论前必须登录!
注册