WordPress 原创

WordPress伪静态设置 (win主机伪静态规则 )

爱搜学习网的头像 爱搜学习网 · · 回复 0 回复本帖
只看楼主 倒序浏览 共 0 楼 第 1 / 1 页
楼主 2016-01-27 11:41 2,717 阅读 1#

WordPress伪静态设置规则,301重定向设置方法(win主机)

本站空间为win主机,关于伪静态和301重定向问题,研究了好长时间终于好了。现在共享给win主机的同学。
win主机伪静态和301重定向都需要用到httpd.ini文件,上传到网站根目录。
(有httpd.ini文件的修改,没有的直接新建)
先上完整代码:

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteCond Host: ^yhaow.com$
RewriteRule (.*) http://blog.yhaow.com$1 [R,I]
# 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]

WP伪静态说明:
需要在wordpress后台 设置→固定连接→自定义为 /%category%/%postname%.html
[toggle title=”固定连接参数”]%year%:基于文章发布的年份;
%monthnum%:基于文章发布的月份;
%day%:基于文章发布当日;
%hour%:基于文章发布小时数;
%minute%:基于文章发布分钟数;
%second%:基于文章发布秒数;
%postname%:基于文章的postname,其值为撰写时指定的缩略名,不指定缩略名时是文章标题;
%post_id%:基于文章post_id;
%category%:基于文章分类,子分类会处理成“分类/子分类”这种形式;
%author%:基于文章作者名。[/toggle]
[toggle title=”网上常见的几种设置方法”]/%year%/%monthnum%/%day%/%postname%/
/%year%/%monthnum%/%postname%/
/%year%/%monthnum%/%day%/%postname%.html
/%year%/%monthnum%/%postname%.html
/%category%/%postname%.html
/%post_id%.html
本站采用/%post_id%.html格式,个人觉得简单[/toggle]

301重定向说明:

以本站为例:需要把ainiseo.com重定向到www.ainiseo.com
代码如下:

RewriteCond Host: ^ainiseo.com$ RewriteRule (.*) http://ainiseo.com$1 [R,I] 以上代码,请根据你的网站自行修改。

常见问题

《WordPress伪静态设置 (win主机伪静态规则 )》主要讲什么?

Wordpress伪静态设置规则,301重定向设置方法(win主机) 本站空间为win主机,关于伪静态和301重定向问题,研究了好长时间终于好了。现在共享给win主机的同学。 win主机伪静态和301重定向都需要用到httpd.ini文件,上传到网站根目录。 (有httpd.ini文件的修改,没有的直接新建) 先上完整

WordPress相关内容,适合谁看?

适合关注WordPress的读者,尤其是需要落地执行的运营和建站从业者。

回复
签名:爱搜学习网站长,14年SEO与网站建设实操经验,专注搜索引擎优化、WordPress建站、百度与Google SEO、服务器运维和网站流量增长。
全部回复 0 正序 倒序
还没有回复,来抢沙发。
发表回复请遵守版规,广告与灌水一律删除

支持 HTML 基础标签,如 <blockquote>、<strong>

QQ 微信 Telegram whatsApp
分享本页
返回顶部