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

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

[复制链接]

430

主题

615

回帖

4155

积分

管理员

积分
4155
QQ
发表于 2025-4-2 20:51:47 | 显示全部楼层 |阅读模式
在nginx伪静态里,换成这个! M$ f1 M% `& g$ \% T
4 P5 c  q7 O9 S& X
  1. location /typecho/ {
    1 B5 ], ?/ o! W
  2.     if (!-e $request_filename) {/ K, \9 m3 t. p2 s% K1 l
  3.         rewrite ^(.*)$ /typecho/index.php$1 last;
    . |( m. w% P1 s; {# y" _
  4.     }
    : B  j) _* v% s0 b
  5. }) h. v6 \- j% l) d5 [5 Q

  6. + l5 F; k/ f+ L) X8 q- }
  7. 9 r/ ~. r2 m+ Z: n! s8 G. W2 b
  8. location / {6 A5 a6 Y1 ]9 P4 A. Z& T# n
  9.     if (-f $request_filename/index.html){
    - M' M* y% F' L6 a( Y! s
  10.         rewrite (.*) $1/index.html break;
    ) C; ^7 Y/ u* z$ F. C
  11.     }0 |% v' T  B% B* N: _" W
  12.     if (-f $request_filename/index.php){
    1 D' V3 j' [2 T' V
  13.         rewrite (.*) $1/index.php;
    * F1 M* X4 h. G0 c* M$ e2 M
  14.     }$ h' j  }: l2 A5 @, p
  15.     if (!-f $request_filename){
    ' X! U; C) O; ?4 S$ b
  16.         rewrite (.*) /index.php;
    / s& o6 q$ s% G2 T- v4 h
  17.     }
    . a2 s1 `, t% O* H: r5 x* l% u
  18.     try_files $uri $uri/ =404;5 b9 Z3 E  `* R
  19. }
复制代码
回复

使用道具 举报

430

主题

615

回帖

4155

积分

管理员

积分
4155
QQ
 楼主| 发表于 2025-4-2 20:54:07 | 显示全部楼层
用这一段也行
  1. location / {$ r# K' E, {! i2 x; g, _
  2.     if (-f $request_filename/index.html){
    ' {/ K$ z. A9 ~3 o/ U
  3.         rewrite (.*) $1/index.html break;7 M& ^0 z$ }7 X6 W0 }
  4.     }- a1 S- y1 x8 U5 k7 _; @
  5.     if (-f $request_filename/index.php){
    * c: |2 J1 k. ]( y" D2 E
  6.         rewrite (.*) $1/index.php;
    # f3 v2 v: P  w2 V8 g8 v2 S  p
  7.     }
    : h) f1 e0 d! U* z
  8.     if (!-f $request_filename){
    7 o% W1 }; M! @5 K4 N* d1 t4 M
  9.         rewrite (.*) /index.php;
    4 U  a  B$ C/ s3 T
  10.     }7 j8 n' ?3 u7 C
  11.     try_files $uri $uri/ =404;
    ( c/ {! `2 b2 o1 a3 L
  12. }
复制代码
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-5-9 20:28 , Processed in 0.019069 second(s), 21 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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