Typecho去掉index.php

NOCO发布于 分类 Typecho

3天前 有1个用户阅读过

Typecho去掉index.php的方法与其他的网站程序去掉index.php的方式一样。都是借助web服务器软件的rewrite功能支持实现!

Tyoecho去掉网站所有页面链接中的index.php需要在typecho后台设置--永久链接设置--启用 是否使用地址重写功能。如果是apache环境,同时会默认在根目录生成相应的.htaccess文件,文件内容参考后面的内容。如果是nginx,需要人工设置一下规则!

Apache下去掉index.php

需要在根目录下创建.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

Nginx下去掉index.php

需要修改nginx配置文件,在对应网站的server中增加相应rewrite规则!

location / {

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

-- The End --

本文标题: Typecho去掉index.php

本文地址: https://seonoco.com/blog/typecho-remove-index-php

本文是否有所帮助?
点赞 0
感谢支持
0
多谢反馈
评论 0
打赏

支持微信/支付宝

评论

网友