当前位置:网站首页>设置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后台设置需要的固定链接即可
边栏推荐
- Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform
- LeetCode. 剑指offer 62. 圆圈中最后剩下的数
- JS reverse -- ob confusion and accelerated music that poked the [hornet's nest]
- 分享一个通用的so动态库的编译方法
- Realize incremental data synchronization between MySQL and ES
- JTAG principle of arm bare board debugging
- 2022 Google CTF segfault Labyrinth WP
- Meet in the middle
- 云呐-工单管理制度及流程,工单管理规范
- NEON优化:log10函数的优化案例
猜你喜欢
随机推荐
Neon Optimization: About Cross access and reverse cross access
系统休眠文件可以删除吗 系统休眠文件怎么删除
Match VIM from zero (0) -- Introduction to vimscript
[signal and system]
What are the differences between Oracle Linux and CentOS?
Send template message via wechat official account
uva 1401 dp+Trie
Using the entry level of DVA in taro3.*
2022 Google CTF SEGFAULT LABYRINTH wp
Atomic in golang and CAS operations
json学习初体验–第三者jar包实现bean、List、map创json格式
c语言—数组
Start from the bottom structure to learn the customization and testing of fpga---- FIFO IP
curl 命令
2022 Google CTF SEGFAULT LABYRINTH wp
Telnet,SSH1,SSH2,Telnet/SSL,Rlogin,Serial,TAPI,RAW
C语言实例_4
黑马笔记---创建不可变集合与Stream流
从底层结构开始学习FPGA----FIFO IP的定制与测试
Table table setting fillet