阳光淡蓝 发表于 2017-8-8 11:42:16

请问有知道Lnmp DZ的伪静态怎么设置么

参照网上说的,在网站配置文件加了以下代码重启都报错~ 有知道的基友么,谢谢了。

if (-f $request_filename/index.html){
                rewrite (.*) $1/index.html break;
      }
      if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
      }
      if (!-f $request_filename){
                rewrite (.*) /index.php;
      }

或者:
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-(+)-(+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-(+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-(+)-(+)-(+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-(+)-(+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/blog-(+)-(+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
rewrite ^([^\.]*)/(fid|tid)-(+)\.html$ $1/index.php?action=$2&value=$3 last;
rewrite ^([^\.]*)/(+*)-(+)\.html$ $1/plugin.php?id=$2:$3 last;
if (!-e $request_filename) {
        return 404;
}

cclylycc 发表于 2017-8-8 11:43:24

我网站:

RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-(+)-(+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(\w+)-(+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-(+)-(+)-(+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-(+)-(+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^blog-(+)-(+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^archiver/(fid|tid)-(+)\.html$ archiver/index.php?action=$1&value=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(+*)-(+)\.html$ plugin.php?id=$1:$2&%1

阳光淡蓝 发表于 2017-8-8 11:45:01

cclylycc 发表于 2017-8-8 11:43
我网站:

RewriteEngine On


最后一个笑脸符号是什么 可以用代码括起来么 谢啦~~:handshake

cclylycc 发表于 2017-8-8 11:46:54

阳光淡蓝 发表于 2017-8-8 11:45
最后一个笑脸符号是什么 可以用代码括起来么 谢啦~~

RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-(+)-(+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(\w+)-(+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-(+)-(+)-(+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-(+)-(+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^blog-(+)-(+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^archiver/(fid|tid)-(+)\.html$ archiver/index.php?action=$1&value=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(+*)-(+)\.html$ plugin.php?id=$1:【$】2&%1

【】去除即可

阳光淡蓝 发表于 2017-8-8 11:54:35

cclylycc 发表于 2017-8-8 11:46
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)$


谢谢,但重启时提示这个

Stoping LNMP...
Stoping nginx... nginx: unknown directive "RewriteEngine" in /usr/local/nginx/conf/vhost/12345.com.conf:49
failed. Use force-quit
Shutting down MySQL. SUCCESS!
Gracefully shutting down php-fpm . done
Starting LNMP...
Starting nginx... nginx (pid 16453 16450) already running.
Starting MySQL. SUCCESS!
Starting php-fpmdone

萤火之光 发表于 2017-8-8 11:57:42

12345.com 能卖海景房的钱吧

阳光淡蓝 发表于 2017-8-9 07:25:47

有知道针对最新版的DZ 应如何添加规则么:)

萌䒤萌 发表于 2017-8-9 07:38:50

阳光淡蓝 发表于 2017-8-8 11:54
谢谢,但重启时提示这个

Stoping LNMP...


你是nginx用什么apache的伪静态配置,
dz后台就可以看到要用的伪静态规则
页: [1]
查看完整版本: 请问有知道Lnmp DZ的伪静态怎么设置么