最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
WordPress Nginx Rewrite规则详解
时间:2022-06-25 18:47:16 编辑:袖梨 来源:一聚教程网
发下自用的WordPress Nginx重定向规则,适合非子目录安装:
location / {
try_files $uri $uri/ /index.php?$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
AMH自带的为:
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){
rewrite (.*) /index.php;
}
}
简单使用方法:AMH使用AMRewrite插件新建一条Rewrite规则,校验规则,然后编辑虚拟主机,选择新建的规则。
直接改nginx.conf了解的自然了解
另外一种nginx下WordPress固定链接的伪静态规则
在nginx配置文件nginx.conf的location段添加一行就OK。
1. 打开nginx配置文件:
# vim /etc/nginx/nginx.conf(此路径根据Linux版本与安装路径会有不同)
2. 在server容器中添加下面这几行
location /
{
try_files $uri $uri/ /index.php?q=$uri&$args;
}
3. 重新加载nginx配置文件
# /etc/init.d/nginx reload
相关文章
- 哈利波特魔法觉醒拼图寻宝格兰芬多塔楼线索位置攻略 08-01
- 金铲铲之战中秋挑战活动怎么玩?中秋双人大作战玩法介绍 08-01
- 《魔法少女小圆MagiaExedra》月卡可获取奖励一览 08-01
- 《地下城堡4》军团战通关攻略 08-01
- 《地下城堡4》惊悸荒野小屋解密攻略 08-01
- 币圈三大主流交易所详解 币安 Coinbase 火币对比分析 08-01