欢迎来到资源库(www.zyku.net)

WordPress

当前位置:首页 > CMS教程 > WordPress > 伪静态

wordpress各种web环境下的伪静态规则

时间:2017-03-04|栏目:WordPress|点击:|我要投稿

wordpress默认的链接是动态的形式,虽然这点对于现在的搜索引擎爬虫抓取内容已经不会再构成影响了,但是伪静态的链接更具有层级结构关系,更有利于蜘蛛抓取。下面就说说各个web系统下wordpress的伪静态规则。

apache环境下的wordpress伪静态规则:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

新建一个.htaccess文件并将以上代码写入.htaccess文件中,上传至wordpress站点的根目录中。

IIS环境下的wordpress伪静态规则(方法一):

打开站点根目录下的web.config文件并加入以下代码:

<rewrite>
    <rules>
        <rule name="Main Rule" stopProcessing="true">
            <match url=".*" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:0}" />
        </rule>
    </rules>
</rewrite>

IIS环境下的wordpress伪静态规则(方法二):

新建一个httpd.ini文件并加入以下代码:

[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 ^/$ /index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /(.*) /index.php/$1 [L]

上传至wordpress站点根目录。

nginx环境下的wordpress伪静态方法:

location / { 
        index index.html index.php; 
        if (-f $request_filename/index.html){ 
            rewrite (.*) $1/index.html break; 
        } 
        if (-f $request_filename/index.php){ 
            rewrite (.*) $1/index.php; 
        } 
        if (!-f $request_filename){ 
            rewrite (.*) /index.php; 
        } 
    }

将以上代码加入到nginx.conf文件的Server段内。

以上就是所有web环境下的wordpress伪静态规则。

(资源库 www.zyku.net)

上一篇:wordpress为文章加上字数统计功能

栏    目:WordPress

下一篇:wordpress禁止非管理员用户更改密码的方法

本文标题:wordpress各种web环境下的伪静态规则

本文地址:https://www.zyku.net/wp/1087.html

关于我们 | 版权申明 | 寻求合作 |

重要申明:本站所有的文章、图片、评论等内容,均由网友发表或上传并维护或收集自网络,仅供个人学习交流使用,版权归原作者所有。

如有侵犯您的版权,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:95148658 | 邮箱:mb8#qq.com(#换成@)

苏ICP备2020066115号-1

本网站由提供CDN加速/云存储服务