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

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

[复制链接]

343

主题

548

回帖

3607

积分

管理员

积分
3607
QQ
发表于 2025-4-2 20:51:47 | 显示全部楼层 |阅读模式
在nginx伪静态里,换成这个
" e* J' M& L; s$ f, g- a' l  t* D1 g! M
  1. location /typecho/ {1 d. ~' i" e' R6 `) v' u: I
  2.     if (!-e $request_filename) {" q+ S& o, _4 n7 D
  3.         rewrite ^(.*)$ /typecho/index.php$1 last;% ^0 D5 C2 ?8 O  A8 J* v. i
  4.     }
    & M  i0 V/ l" o2 {6 o; D# M' Z4 l
  5. }" }# ?2 Y' p8 S7 G+ y4 h. A5 C
  6. 0 q3 ^: G. {! j3 |
  7. + W% i' s- l( S. p
  8. location / {
      K# J  J1 j9 }, W7 m- D" X2 a
  9.     if (-f $request_filename/index.html){
    . u2 L7 d  k5 g7 a, f
  10.         rewrite (.*) $1/index.html break;
    * E5 p+ B$ l  x# I) x
  11.     }! ^0 m/ _$ {4 u7 ~3 D1 Y! s
  12.     if (-f $request_filename/index.php){9 L' V* Y" v0 n3 g5 U
  13.         rewrite (.*) $1/index.php;$ C) G4 J: p3 L' @7 a& K% x
  14.     }
    . F1 I& a" v, t* A
  15.     if (!-f $request_filename){
    - c; |3 k9 X, N2 b
  16.         rewrite (.*) /index.php;
    " @; I( G( O, h
  17.     }
    " X3 O, H7 j5 f7 ]
  18.     try_files $uri $uri/ =404;
    0 ^& T1 l, M* }3 A
  19. }
复制代码
回复

使用道具 举报

343

主题

548

回帖

3607

积分

管理员

积分
3607
QQ
 楼主| 发表于 2025-4-2 20:54:07 | 显示全部楼层
用这一段也行
  1. location / {0 y- P$ J2 K& `) M4 x/ W
  2.     if (-f $request_filename/index.html){6 q; `+ B) Z% u/ e% t( G' V
  3.         rewrite (.*) $1/index.html break;
    $ ~& `9 G" b* @: f
  4.     }( i9 w& q+ y% n: R/ S
  5.     if (-f $request_filename/index.php){
    0 Y! m- l8 ~  d1 K8 K
  6.         rewrite (.*) $1/index.php;
    7 c0 J2 @+ x- z* i
  7.     }2 K: Z4 U: ]: a/ W* O2 H9 {
  8.     if (!-f $request_filename){. ]' Y" {9 y$ V$ @2 K" h: D! m% f
  9.         rewrite (.*) /index.php;
    $ ?, V8 j$ _2 @" G: Q* {
  10.     }
    6 x; J) R! `( w  E
  11.     try_files $uri $uri/ =404;4 w  O/ U- V* B2 ^: t2 D2 M* |
  12. }
复制代码
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-29 20:33 , Processed in 0.028090 second(s), 2 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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