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

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

思有云 - 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教程

 •