Permanent Links" in sequence; then open "Website-Settings-Configuration File" in sequence; then modify the nginx configuration rules and save them."/> Permanent Links" in sequence; then open "Website-Settings-Configuration File" in sequence; then modify the nginx configuration rules and save them.">

Home  >  Article  >  Backend Development  >  How to remove index.php with typecho

How to remove index.php with typecho

藏色散人
藏色散人Original
2020-08-22 10:46:374413browse

typecho去掉index.php的方法:首先依次打开“设置->永久链接”;然后依次打开“网站-设置-配置文件”;接着修改nginx配置规则并保存即可。

How to remove index.php with typecho

推荐:《PHP视频教程

Typecho去掉index.php让链接更美观

Typecho后台设置永久链接后,会在域名后加上index.php,很多人都接受不了

更改前是这样的:http://sunpma.com/index.php/archives/86/

更改后是这样的:http://sunpma.com/86.html

开始设置

打开设置 / 永久链接,改成如下图所示

这时会提醒你“重写功能检测失败,请检查你的服务器设置” 不用理会继续开启,然后保存设置

How to remove index.php with typecho

按照以上设置,文章链接会是数字,比如:/86.html

而分类页和独立页面会是缩阅名,而缩阅名可以自己设置,比如:/ss.html

注意:现在打开你的博客文章会出现404错误

然后我们需要修改nginx配置规则

如果使用的宝塔面板,就在 网站-设置-配置文件 里面修改

在规则里加入以下代码后保存

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

以宝塔面板为例:

How to remove index.php with typecho

好了,一切都搞定了,现在打开你博客文章看看吧!

The above is the detailed content of How to remove index.php with typecho. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn