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

推荐订阅源

T
Tenable Blog
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
H
Help Net Security
F
Fortinet All Blogs
MyScale Blog
MyScale Blog
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
量子位
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
Vercel News
Vercel News
aimingoo的专栏
aimingoo的专栏
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Scott Helme
Scott Helme
The Last Watchdog
The Last Watchdog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
AI
AI
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
U
Unit 42
V2EX - 技术
V2EX - 技术
MongoDB | Blog
MongoDB | Blog
Schneier on Security
Schneier on Security
博客园 - Franky
H
Heimdal Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Cloudbric
Cloudbric
B
Blog RSS Feed
N
News | PayPal Newsroom
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
雷峰网
雷峰网

思有云 - IOIOX - Nginx

Nginx 配置 OCSP Stapling 优化 HTTPS 访问 - 思有云 Docker 打造支持快速部署和迁移的 Nginx 环境 - 思有云 配置 Nginx 和 frps 共存 80/443 端口及泛域名支持教程 - 思有云 Nginx设置301重定向到www和强制跳转https教程 - 思有云 - IOIOX
Nginx设置Typecho伪静态去掉index.php教程 - 思有云 - IOIOX
博主: Stille · 2019-03-07 · via 思有云 - IOIOX - Nginx
  • 发布时间:
  • 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教程

 •