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

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

[复制链接]

317

主题

480

回帖

3065

积分

管理员

积分
3065
QQ
发表于 2025-4-2 20:51:47 | 显示全部楼层 |阅读模式
在nginx伪静态里,换成这个8 \0 k. t0 p' v# G. Y, _

! k6 l9 U4 u0 [" A% d
  1. location /typecho/ {1 C8 b! H. ?! b$ L: w7 k3 m$ Y
  2.     if (!-e $request_filename) {* a1 |0 `; }; I4 L/ f: \! M5 W/ l
  3.         rewrite ^(.*)$ /typecho/index.php$1 last;6 e1 ^" h2 h7 ^4 r' ]( |2 H
  4.     }
    9 g- [1 `* j( c' u; |
  5. }$ B" F0 k) t3 D6 m

  6. 7 k' X/ z- `9 F  {

  7. 2 u" L. q3 k* L, o: H6 c
  8. location / {
    6 a1 G- n. V  R1 \; Y& e9 t0 C
  9.     if (-f $request_filename/index.html){# b+ s, U# ?, A; c+ {
  10.         rewrite (.*) $1/index.html break;
    / u: x8 R0 Z% {6 F1 A
  11.     }. Q2 S" O# g% _( |3 i1 s
  12.     if (-f $request_filename/index.php){
    ) c. E. c, w, t* o% q0 w
  13.         rewrite (.*) $1/index.php;
    ; w# \0 R9 ^$ f3 K7 q. t9 t
  14.     }
    $ Y' ~, V& m7 H% C
  15.     if (!-f $request_filename){
    * [6 E% d: l9 {% ^$ E" P  i  N
  16.         rewrite (.*) /index.php;- Z% ~6 L0 D2 W& S9 i* L8 Q
  17.     }
    2 d) F2 I% k- ]& `! x
  18.     try_files $uri $uri/ =404;
    6 x1 D8 |8 A: I5 o. u
  19. }
复制代码
回复

使用道具 举报

317

主题

480

回帖

3065

积分

管理员

积分
3065
QQ
 楼主| 发表于 2025-4-2 20:54:07 | 显示全部楼层
用这一段也行
  1. location / {
    ' L2 _0 F3 k! Q
  2.     if (-f $request_filename/index.html){6 N+ j- J* K4 A& N
  3.         rewrite (.*) $1/index.html break;
    : g9 f' Z3 R9 h6 y
  4.     }
    & m2 X! I/ S  {4 \: q$ d
  5.     if (-f $request_filename/index.php){
    0 O3 S. Q2 ~0 [5 ^+ K
  6.         rewrite (.*) $1/index.php;
    ( m) ]8 i5 k0 o4 V3 ~
  7.     }4 s5 e6 l4 F+ ?# ?
  8.     if (!-f $request_filename){$ T( t9 z  R% v5 G" p6 ?7 Y
  9.         rewrite (.*) /index.php;1 J6 S* H7 z# ?2 M" O
  10.     }5 _8 ~0 e3 X' z# f. S
  11.     try_files $uri $uri/ =404;) S0 y6 ^7 D, `  A1 X( H6 G( j
  12. }
复制代码
回复

使用道具 举报

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

本版积分规则

QQ|Archiver|手机版|小黑屋|通达产控投资 ( 粤ICP备2023021749号-1|粤公网安备 44030402006137号 )

GMT+8, 2025-5-24 02:29 , Processed in 0.070341 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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