• 首页
  • 归档
  • 搜索
  • 夜间模式
    ©2026  布吉岛 Theme by OneBlog

    布吉岛博客

    搜索
    标签
    # typecho
  • 首页>
  • 网络拾忆>
  • 正文
  • Typecho开启伪静态

    2026年02月04日 94 阅读 0 评论 981 字

    1. 开启宝塔伪禁态

    登录宝塔面板
    切换到网站选项卡
    找到你的博客网站,点击右侧设置
    在设置弹窗中,左侧找到伪静态选项卡,并切换成它

    在右侧输入框中填写如下内容

        location / {
      index index.html index.php;
      if (-f $request_filename/index.html) {
        rewrite (.*) $1/index.html break;
      }
      if (-f $request_filename/index.php) {
        rewrite (.*) $1/index.php;
      }
      if (!-f $request_filename) {
        rewrite (.*) /index.php;
      }
    }

    2. Apache环境开启伪静态

    启用mod_rewrite模块:修改httpd.conf,取消LoadModule rewrite_module modules/mod_rewrite.so的注释(去掉前面的#)。
    允许.htaccess覆盖:将AllowOverride None改为AllowOverride All(使Apache支持.htaccess文件)。

    添加.htaccess规则:在网站根目录创建或编辑.htaccess,添加以下内容:

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

    虚拟主机用户可直接在面板开启“伪静态支持”,无需修改httpd.conf

    本文著作权归作者 [ 布点 ] 享有,未经作者书面授权,禁止转载,封面图片来源于 [ 互联网 ] ,本文仅供个人学习、研究和欣赏使用。如有异议,请联系博主及时处理。
    typecho
    取消回复

    发表留言
    回复

    首页归档
    Copyright©2026  All Rights Reserved.  Load:0.011 s
    陕ICP备2025073275号-1
    Theme by OneBlog V3.6.5
    夜间模式

    开源不易,请尊重作者版权,保留基本的版权信息。