当前位置:网站首页>设置Wordpress伪静态连接(无宝塔)
设置Wordpress伪静态连接(无宝塔)
2022-07-06 18:01:00 【挚夏】
设置Wordpress伪静态链接
Apache2.4
本文是不在使用宝塔的情况下自行设定的, 有安装宝塔的请忽视
环境:Ubuntu20.04 Apache2.4 Wordpress5.9.2
重写规则
开启重写规则
sudo a2enmod rewrite
设置根目录重定向
sudo vim /etc/apache2/apache2.conf
找到
<Directory /var/www/>
将
AllowOverride
后的None
修改为ALL
。进入Wordpress后台选择自己喜欢的伪静态,并点击保存,自动生成
.hatccess
规则并复制,如下:<IfModule mod_rewrite.c> RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteRule ^^unsubscribe-comment-mailnotice/?(.*)$ //wp-con> RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
- 在刚刚的
/var/www/
目录下(即网站的根目录) 创建.hatccess
文件
粘贴刚刚复制的规则代码并保存。
- 在刚刚的
重启服务器即可
sudo systemctl restart apache2
效果图
Nginx1.19
本文是不在使用宝塔的情况下自行设定的, 有安装宝塔的请忽视
环境:Raspi OS 64bit(Debian11) Wordpress5.9.2
打开配置文件sudo vim /etc/nginx/sites-available/default
如果wordpress安装在网站根目录,在server中添加
location / {
if (!-e $request_filename) {
rewrite (.*) /index.php;
}
}
如果wordpress安装在网站二级目录,在server中添加:
location /二级目录/ {
if (!-e $request_filename) {
rewrite (.*) /cn/index.php;
}
}
重启sudo /etc/init.d/ngnix restart
在wordpress后台设置需要的固定链接即可
边栏推荐
- 1123. 最深叶节点的最近公共祖先
- LeetCode:1175. Prime permutation
- ClickHouse字段分组聚合、按照任意时间段粒度查询SQL
- mysqlbackup 还原特定的表
- C language instance_ four
- 安利一波C2工具
- Implementation principle of waitgroup in golang
- Comparison of picture beds of free white whoring
- NEON优化:log10函数的优化案例
- What does security capability mean? What are the protection capabilities of different levels of ISO?
猜你喜欢
Analysis of mutex principle in golang
454-百度面经1
Typical problems of subnet division and super network construction
1123. 最深叶节点的最近公共祖先
免费白嫖的图床对比
Clickhouse fields are grouped and aggregated, and SQL is queried according to the granularity of any time period
go-zero微服务实战系列(九、极致优化秒杀性能)
2022 Google CTF SEGFAULT LABYRINTH wp
黑马笔记---创建不可变集合与Stream流
[case sharing] basic function configuration of network loop detection
随机推荐
2022 Google CTF segfault Labyrinth WP
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
JTAG principle of arm bare board debugging
免费白嫖的图床对比
AI 从代码中自动生成注释文档
云呐|工单管理软件,工单管理软件APP
HMM 笔记
mysqlbackup 还原特定的表
uva 1401 dp+Trie
NEON优化:矩阵转置的指令优化案例
黑马笔记---异常处理
Typical problems of subnet division and super network construction
Atomic in golang, and cas Operations
Start from the bottom structure to learn the customization and testing of fpga---- FIFO IP
Yunna | work order management software, work order management software app
如何管理分布式团队?
Machine learning: the difference between random gradient descent (SGD) and gradient descent (GD) and code implementation.
从底层结构开始学习FPGA----FIFO IP的定制与测试
Docker method to install MySQL
剑指 Offer II 035. 最小时间差-快速排序加数据转换