当前位置:首页 > 服务器日常问题 > IIS配置经验 > 正文内容

wordpress伪静态规则支持中文标签httpd.ini

xmwl2年前 (2022-07-09)IIS配置经验733

请将以下代码另存为httpd.ini存放在网站的web目录中,即可生效。(只适用于windows主机)


第一种
支持中文标签以及中文分类
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 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 /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]
第二种
通用伪静态
[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 /sitemap.xml.gz /sitemap.xml.gz [L]
RewriteRule /robots.txt /robots.txt [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]
第三种
适用于iis 7.5或以上版本的wordpress伪静态规则(需要另存为web.config文件名)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>

<rewrite>
<rules>

<rulename="Main Rule"stopProcessing="true">
<matchurl=".*"/>
<conditionslogicalGrouping="MatchAll">
<addinput="{REQUEST_FILENAME}"matchType="IsFile"negate="true"/>
<addinput="{REQUEST_FILENAME}"matchType="IsDirectory"negate="true"/>
<actiontype="Rewrite"url="index.php/{R:0}"/>

</rule>
</rules>
</rewrite>
    </system.webServer>
</configuration>


版权声明:
本站资源和文章内容大部分收集于网络,
本站所有资源的版权均属于原作者所有,
本站资源只用于参考学习,请勿直接商用,
若由于商用引起版权纠纷,一切责任均由使用者承担。
若有侵权之处请联系站长我们会第一时间删除

本文由XM技术学习分享发布,如需转载请注明出处。

本文链接:http://xmwl.cc/iis/106.html

分享给朋友: