首页 游戏资源分享 网站网页教程 WordPress 和Discuz 伪静态正常使用
0赞
赞赏
手机版
扫码打开手机版
把文字装进口袋

WordPress 和Discuz 伪静态正常使用

糖果 2026-1-25 07:23:00
  1.     location / {
  2.         index indexdz.php index.html index.php;
  3.         
  4. if ($args ~* "^p=(\d+)") {
  5.     # 如果URL包含?p=参数,直接重写到WordPress的index.php
  6.     rewrite ^/(.*)$ /index.php last;
  7. }
  8. if ($args ~* "^(cat|tag|s|author|year|monthnum|day|name|feed|page_id|attachment_id|post_type)=") {
  9.     # 如果URL包含WordPress常用查询参数,重写到WordPress的index.php
  10.     rewrite ^/(.*)$ /index.php last;
  11. }   
  12.         # Discuz的文件检查和重写规则
  13.         if (-f $request_filename/index.html){
  14.             rewrite (.*) $1/index.html break;
  15.         }
  16.         if (-f $request_filename/indexdz.php){
  17.             rewrite (.*) $1/indexdz.php;
  18.         }
  19.         if (-f $request_filename/index.php){
  20.             rewrite (.*) $1/index.php;
  21.         }
  22.         if (!-f $request_filename){
  23.             rewrite (.*) /index.php;
  24.         }
  25.     }

  26. rewrite /wp-admin$ $scheme://$host$uri/ permanent;


  27.         rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
  28.         rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
  29.         rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
  30.         


  31.         rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
  32.         rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
  33.         rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
  34.         rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
  35.         rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
  36.         rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
  37.         rewrite ^([^\.]*)/q[-|/]+(.*?)$ $1/plugin.php?id=onexin_keywords&rewrite=$2 last;
复制代码


使用道具 举报

您需要登录后才可以回帖 立即登录
返回顶部