本页目录
在我们的 Typecho 博客后台设置永久链接后,会在域名后自动的加上 index.php,这样以来,很多像牧泽这样喜欢干干净净的人就接受不了。
而且,一个简单干净的 URL 不仅能给人带来视觉上的享受,还能吸引搜索引擎的爬虫,也能便捷的将美观的链接发送出去。
- 参考文章:详情
因为我使用的是 Nginx(推荐大家使用),所有我是这样设置的,首先,来到宝塔面板,找到“网站选项”,找到自己的 typecho 网站,如下图进行设置:

1.后台配置 typecho 伪静态
如图,在 typecho 后台,开启伪静态,并选择你喜好的 url 形式:

然后点击保存按钮。刷新网站前台即可看到效果。
以下方法为经验证,仅供参考。
如果你没有使用宝塔面板的话,我们想配置服务器的 rewrite 规则,你也可以将以下代码按照实际情况添加至网站根目录的隐藏文件: .htaccess 中
nginx 配置
server { listen 80; server_name yourdomain.com; root /home/yourdomain/www/; index index.html index.htm index.php;
if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; }
location ~ .*\.php(\/.*)*$ { include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; }
access_log logs/yourdomain.log combined; }apache 配置(不推荐使用 Apache)
此配置也可以放在 apache 的 conf 文件中
<IfModule mod_rewrite.c> RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>