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

ordPress伪静态设置规则,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://www.laoguu.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重定向说明:

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

RewriteCond Host: ^laoguu.com$ RewriteRule (.*) http://www.laoguu.com$1 [R,I] 


以上代码,请根据你的网站自行修改。

你可能感兴趣的:(wordpress,wordpress)