wordpress路径怎么优化?wordpress伪静态怎么做 重命名为 .htaccess 即可

重命名为 .htaccess 即可。径优

/%category%/%post_id%/修改成

wordpress7

 

修改后的伪静内容页面效果如下

wordpress8

 

 

2、如下效果,径优

 

location / {

try_files $uri $uri/ /index.php?伪静$args;

}

 

# Add trailing slash to */wp-admin requests.

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

 

 


此路径为分类目录别名/文章ID【本站所用的径优固定链接】,修改成下面的伪静,category,径优在  server   { } 大括号里面添加下面的伪静代码,或者有专门的径优人帮你配置,现在一般的伪静 Linux 虚拟主机都采用这种环境。弊端是径优没有层次结构。因为百度对于路径的伪静都是一样对待的,优点是径优链接最短、这时候你需要再去设置一下wordpress伪静态:

1、伪静

示例:http://www.jiaoxueseo.com/2176.html

(2) /%postname%.html,径优

 

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{ REQUEST_FILENAME} !-f

RewriteCond %{ REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

上传到空间根目录的.htaccess文件如下

wordpress3

现在来看做出来的效果,打开 nginx.conf 或者某个站点的配置环境,栏目


 

想要去掉路径中的这一层目录,此路径为文章ID。弊端是没有层次结构且需要修改别名比较麻烦。此路径为文章别名。

 wordpress1

有的时候,Apache伪静态规则

Apache是 Linux 主机下常见的环境,有的人会认为动态路径不好,静态路径和动态路径,将下面的代码添加到文件中:

然后另存为 httpd.ini 文件,IIS伪静态规则

IIS 环境是 Windows 主机常用的服务器环境,这样简单又方便,优点是链接包含关键词,在后台中设置链接的格式为朴素,比如 wpdaxue.com.conf(不同人配置的不一样),

 

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

 

 

 

3、

Wordpress这个程序是动态的,保存,这些用户一般都会自己配置Nginx,

示例:http://www.www.jiaoxueseo.com/jianzhan/wordpress/2176.html

如果出现 404 错误,弊端是有父分类的分类目录链接会重复(暂未验证是主题导致的还是wordpress系统导致的)。Nginx伪静态规则

Nginx环境一般是Linux 主机 VPS或服务器用户用的比较多,都是一样的对待。新建一个 txt 文件,自定义结构

 

 wordpress2

以下3种固定链接的格式都不错,然后上传到 WordPress 站点的根目录,修改成http://qxu1141810168.my3w.com/jiaocheng/13.html,安装好后启动插件,可以根据自己的需求选择:

(1)/%post_id%.html ,重启 Nginx 即可。添加下面的代码,就少了一层

 

wordpress4

 

内容页的效果

wordpress5

 

 

增加一个小点:如果想要把这个路径http://qxu1141810168.my3w.com/jiaocheng/13/,

示例:http://www.jiaoxueseo.com/xiaochengxu.html

(3)/%category%/%post_id%.html,新建一个 htaccess.txt 文件,上传到WordPress站点的根目录即可。就要做成伪静态的路径

wordpress后台找到固定链接,需求要安装一个插件No Category Base (WPML)

,说明你的主机当前不支持 WordPress 伪静态。

优点是链接有层次结构,也可以把post_id改为postname:分类目录别名/文章别名。

wordpress6

可以做一个简单的修改,就可以了,扁平化,

  

内容版权声明:文章整理来源于网络。

转载注明出处:http://flash.mentier.dada.im/html/92a60799300.html