惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 【当耐特】
博客园_首页
博客园 - Franky
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
Recorded Future
Recorded Future
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
M
MIT News - Artificial intelligence
D
Docker
H
Help Net Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
S
SegmentFault 最新的问题
腾讯CDC
Latest news
Latest news
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
InfoQ
美团技术团队
C
Cybersecurity and Infrastructure Security Agency CISA
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
C
Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Schneier on Security
Spread Privacy
Spread Privacy
Recent Announcements
Recent Announcements
T
Threat Research - Cisco Blogs
F
Full Disclosure
T
Threatpost
T
Tenable Blog
AWS News Blog
AWS News Blog
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
W
WeLiveSecurity
I
Intezer
月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
Lohrmann on Cybersecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"

思有云 - IOIOX - Typecho

支持 typecho 1.2 的评论邮件通知插件 LoveKKCommentModify - 思有云 Typecho博客全站部署腾讯云CDN教程 - 思有云 - IOIOX Typecho隐藏不显示某一个特定分类教程 - 思有云 - IOIOX 宝塔面板设置Typecho伪静态去掉index.php教程 - 思有云 - IOIOX Apache设置Typecho伪静态去掉index.php教程 - 思有云 - IOIOX 群晖NAS安装配置typecho博客教程 - 思有云 - IOIOX
Nginx设置Typecho伪静态去掉index.php教程 - 思有云 - IOIOX
博主: Stille · 2019-03-07 · via 思有云 - IOIOX - Typecho
  • 发布时间:
  • 50326 次浏览
  • 2 条评论
  • 1830字数
  • 分类: 运维部署
  1. 首页
  2. 正文  

前言

Typecho博客初始安装完成后,博客的任何内页面,地址栏都会有index.php(例如https://www.ioiox.com/index.php/archives/about.html)非常影响美观和网站结构,本文将详解在Nginx环境下如何设置伪静态来去掉index.php

本文为 Stille 原创文章.经实践,测试,整理发布.如需转载请联系作者获得授权,并注明转载地址.


Typecho开启伪静态

  1. 登录管理界面
  2. 设置
  3. 永久链接
  4. 启用地址重写功能
  5. 勾选仍然启动此功能
  6. 选择wordpress风格
  7. 保存设置

关于风格选择,你可以在本文结束后自行在修改成你喜欢的链接风格.

1.jpg

博客配置完毕后,需要配置Nginx才能生效,请继续参考以下教程.

Nginx配置教程

Nginx配置有两种方案均可实现,以下分别介绍:

方案一

编辑站点nginx.conf文件
在80端口的http和443端口的https段落中分别添加301重定向代码

if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php$1 last;
}

2.jpg
3.jpg
保存后上传覆盖你原有的conf文件
输入nginx -t检查错误

重启Nginx后生效

方案二

利用Nginx的include来调用伪静态配置文件
找到Nginx的主conf文件夹,本文以/usr/local/nginx/conf/为例.
在conf下新建文件夹,本文以rewrite为例.
rewrite文件夹下新建typecho.conf
添加以下代码
保存

if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php$1 last;
}

4.jpg

编辑站点nginx.conf文件
在80端口的http和443端口的https段落中分别添加以下代码

include rewrite/typecho.conf;

5.jpg
6.jpg
保存后上传覆盖你原有的conf文件
输入nginx -t检查错误

重启Nginx后生效


结语

本文详解了如何在Nginx设置Typecho伪静态去掉index.php,本站还介绍了在Apache和宝塔面板上设置Typecho伪静态的教程,推荐相关文章以供参考:

Apache设置Typecho伪静态去掉index.php教程
宝塔面板设置Typecho伪静态去掉index.php教程

晚高峰稳定 4K 的 IPLC 机场 解锁各流媒体 支持 ChatGPT. 晚高峰稳定 4K 的 IPLC 机场 解锁各流媒体 支持 ChatGPT. RedteaGO - 最划算的大陆漫游 eSim 流量卡,原生境外 IP,注册就送 3 刀。
RedteaGO - 最划算的大陆漫游 eSim 流量卡,原生境外 IP,注册就送 3 刀。

赞赏作者

如果喜欢我的文章,觉得对你有帮助,请随意赞赏!

Nginx设置Typecho伪静态去掉index.php教程

 •