在web环境下的怎么创建:wordpress伪静态规则

༺小ʚɞ寞༻ WordPress评论16,601字数 1665阅读5分33秒阅读模式

wordpress是当今最主流也是最流行的免费建站系统与博客运营系统,在seo方面也设计的还算合理。wordpress默认的链接是动态的形式,虽然这点对于现在的搜索引擎爬虫抓取内容已经不会再构成影响了,但是伪静态的链接更具有层级结构关系,更有利于蜘蛛抓取。下面说说在web系统怎么创建wordpress的伪静态规则。

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

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} ^wp-content.*

RewriteCond %{REQUEST_FILENAME} ^wp-admin.*

RewriteCond %{REQUEST_FILENAME} ^wp-include.*

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

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

本人就是用的上面这种的,虽然是云主机 但是用了wdcp控制面板 。呵呵 !

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

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

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 /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]

上传至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伪静态规则。

weinxin
LuckTang's Blog 站长语录
LuckTang's Blog,欢迎各位来访!这是我的QQ,扫一扫,加好友。大家一起交流博客建站技术,分享前沿资讯!
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定