WordPress伪静态规则设置教程(wordpress怎么设置伪静态)

WordPress伪静态规则设置教程(wordpress怎么设置伪静态)

扫码添加渲大师小管家,免费领取渲染插件、素材、模型、教程合集大礼包!

想必都了解WordPress和其他网站系统不一样。其它网站系统基本都带有生成静态页面功能。但WordPress只能使用伪静态。在这就不做过多介绍了。下面就来说说WordPress伪静态规则设置教程。

伪静态:即网站本身是动态网页如.php。.asp。.aspx等格式。而这类网页还带“?”加参数来读取数据库。开启伪静态后。动态网页即被转换重写成静态网页类型页面。

如何判读空间是否支持伪静态。在网站后台:设置-固定链接。选择第一个除外。看网站其它页面是否出现404。如果是。则空间不支持伪静态。

WordPress伪静态规则设置教程(wordpress怎么设置伪静态)

只要空间支持伪静态重写URL Rewrite功能。根据服务器主机空间环境。只需加入下列伪静态规则即可。

一。Apache伪静态规则

新建一个 txt 文件。将下面的代码添加到文件中。然后另存为.htaccess文件。上传到WordPress站点的根目录即可。

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

二。Nginx规则

在Nginx中的server模块配置如下内容,打开 nginx.conf 或者某个站点的配置环境。例如 /usr/local/nginx/conf/yzipi.conf。在server{ } 大括号里面添加下面的代码。

location / {

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){

IIS伪静态规则rewrite (.*) /index.php;

}

}

三。IIS伪静态规则

新建一个txt文件。将下面的代码添加到文件中。然后另存为 httpd.ini 文件。上传到WordPress站点的根目录即可。

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

以上就是关于WordPress伪静态规则设置教程介绍。希望对有些小伙伴有所帮助。更多有关于WordPress教程可以参考:WordPress使用教程

分享到 :
相关推荐

美国网站服务器的安全隐患有哪些(美国网站服务器的安全隐患有哪些呢)

美国网站服务器的安全隐患有:1。美国网站服务器的密码和证书管理不严格。轻易被黑客利用...

云服务器如何分区(云服务器如何分区硬盘)

云服务器分区的方法:1.通过控制台连接云服务器。单击计算机。右键进入管理;2.在[&...

服务器租用如何选择便宜的(服务器租用如何选择便宜的硬盘)

服务器租用如何选择便宜的哪个服务器租用便宜?影响服务器租用价格的因素有很多。通常是[...

谷歌代理服务器地址和端口怎么填(chrome更改代理服务器设置在哪)

1、谷歌代理服务器地址和端口怎么填谷歌代理服务器地址和端口是什么?想要使用谷歌代理[...

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注