找回密码
 立即注册
查看: 3770|回复: 1

typecho搜索时出现404的解决办法

[复制链接]

556

主题

688

回帖

4727

积分

管理员

积分
4727
QQ
发表于 2025-4-2 20:51:47 | 显示全部楼层 |阅读模式
在nginx伪静态里,换成这个
) l, e. i1 y. i  u$ A# M8 }; a; O; c5 [6 V
  1. location /typecho/ {5 L  g# i+ n; B& g. ]; {6 G+ w( d
  2.     if (!-e $request_filename) {
      h" q% S/ Z0 x) U
  3.         rewrite ^(.*)$ /typecho/index.php$1 last;
    ; J& x! ?2 R9 C
  4.     }
    , |' e$ _* I% U  S! Q" \
  5. }
    3 P. K& ~" G5 Z# @' [- a5 t1 j/ `

  6. ) I# B) M/ \  o/ h; r
  7.   Z1 s) l4 T  n1 s# X6 W
  8. location / {
    - d" K/ |" q) @5 p. s$ r
  9.     if (-f $request_filename/index.html){
    9 m' I* y- x; P, w
  10.         rewrite (.*) $1/index.html break;" W1 Q5 F$ x8 b% a, M* d
  11.     }8 ~4 |" L  @* f! c! V) _0 \# p7 Z
  12.     if (-f $request_filename/index.php){
    . \5 v- q& ~- K2 j; g* n2 P
  13.         rewrite (.*) $1/index.php;
    : K9 o' H$ {3 I" l
  14.     }8 r: x8 O# e( m+ V5 u7 I2 @
  15.     if (!-f $request_filename){
    ( E( U: p& Z3 k$ O, W
  16.         rewrite (.*) /index.php;
    5 F& M+ a1 K# f: o) a
  17.     }
      x; }9 e% q8 V4 v
  18.     try_files $uri $uri/ =404;
    ' p5 h, \9 A* ^  o" j9 q# B
  19. }
复制代码
欢迎定制:13928122889
回复

使用道具 举报

556

主题

688

回帖

4727

积分

管理员

积分
4727
QQ
 楼主| 发表于 2025-4-2 20:54:07 | 显示全部楼层
用这一段也行
  1. location / {* D+ N% C+ j: \* _
  2.     if (-f $request_filename/index.html){
    ! }0 Y2 K2 B$ W) K$ m7 g% d+ @
  3.         rewrite (.*) $1/index.html break;- t- d1 p9 d! D1 V4 Q0 p2 F" T  I
  4.     }
    ) l' V& a2 y% \/ m( R% y1 Y
  5.     if (-f $request_filename/index.php){2 U6 C& G+ D' u& L7 |' R# U
  6.         rewrite (.*) $1/index.php;- `" O3 n. f) c# C* ~; s
  7.     }6 k4 d! W7 d" b8 V8 L& z. e
  8.     if (!-f $request_filename){: N2 y: a$ @6 t: I" |9 c
  9.         rewrite (.*) /index.php;2 @/ n! l# K! y# _, f# s1 U
  10.     }1 J0 V2 G2 x% K! L8 N
  11.     try_files $uri $uri/ =404;5 \. L2 X: U8 R# v6 x7 h, m3 H/ E7 H( T0 u
  12. }
复制代码
欢迎定制:13928122889
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|通达创业无忧交流社区 ( 粤ICP备2023021749号|粤公网安备 44030402006137号 )

GMT+8, 2026-7-12 07:57 , Processed in 0.011224 second(s), 4 queries , Redis On.

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表