搜索
Hi~登录注册
查看: 1098|回复: 0

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

[复制链接]

1892

主题

1899

帖子

6406

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
6406
发表于 2015-4-15 14:37:32 | 显示全部楼层 |阅读模式
wordpress作为世界上最流行的免费建站系统,在seo方面也设计的很合理。wordpress默认的链接是动态的形式,虽然这点对于现在的搜索引擎爬虫抓取内容已经不会再构成影响了,但是伪静态的链接更具有层级结构关系,更有利于蜘蛛抓取。下面小V就说说各个web系统下wordpress的伪静态规则。 apache环境下的wordpress伪静态规则: RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /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 hourCacheClockRate 3600RepeatLimit 32# Protect httpd.ini and httpd.parse.errors files# from accessing through HTTP# Rules to ensure that normal content gets throughRewriteRule ^/$ /index.php [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule /(.*) /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伪静态规则。
公众微信:idc5ahl
公众QQ:吾爱互联
关注公众微信,公众QQ每天领现金卡密
卡密介绍(http://www.5ahl.com/thread-2182-1-1.html
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 点我注册

快速回复 返回顶部 返回列表