很多朋友都喜欢用宝塔,操作起来很方便,我与云左相遇了有5年了,最近一个朋友需要建站,由于项目不是大项目还是测试试水阶段,我就推荐了相对便宜的云左服务器,便宜还不需要备案,对于初接触建网站的人来说,成本最小了!
有需要的可以填写我的邀请连接,有优惠!(https://my.cloudleft.com/aff.php?aff=1304
WordPress网站如何开启伪静态?云左虚拟机/window系统/lunix设置伪静态-Qui-Note
然后一顿操作,不到10分钟就给他搭建好了,而且还安装了我自己开发的wp主题:QUI-Pure主题,在这个过程中,网站没有伪静态,出现页面404,,记录一下我怎么操作的!

1.Wordpress后台设置“固定连接”
wp后台 》设置》固定连接 》自定义链接结构 填写 /%postname%.html

Nginx规则

本地新建记事本txt文件,将下面文件粘贴进去,并改名和后缀为,不需要加文件名:.htaccess

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

IIS伪静态规则

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

Nginx规则

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;
}
}

然后,刷新页面就ok了!