全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 2056|回复: 7
打印 上一主题 下一主题

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

[复制链接]
跳转到指定楼层
1#
发表于 2017-8-8 11:42:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
参照网上说的,在网站配置文件加了以下代码重启都报错~ 有知道的基友么,谢谢了。

  1. if (-f $request_filename/index.html){
  2.                 rewrite (.*) $1/index.html break;
  3.         }
  4.         if (-f $request_filename/index.php){
  5.                 rewrite (.*) $1/index.php;
  6.         }
  7.         if (!-f $request_filename){
  8.                 rewrite (.*) /index.php;
  9.         }
复制代码


或者:
  1. rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
  2. rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
  3. rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
  4. rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
  5. rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
  6. rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
  7. rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
  8. rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
  9. rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
  10. if (!-e $request_filename) {
  11.         return 404;
  12. }
复制代码
2#
发表于 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-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+)\.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-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$12&%1
3#
 楼主| 发表于 2017-8-8 11:45:01 | 只看该作者
cclylycc 发表于 2017-8-8 11:43
我网站:

RewriteEngine On

最后一个笑脸符号是什么 可以用代码括起来么 谢啦~~
4#
发表于 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-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+)\.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-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$1:【$】2&%1

【】去除即可
5#
 楼主| 发表于 2017-8-8 11:54:35 | 只看该作者
cclylycc 发表于 2017-8-8 11:46
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)$

谢谢,但重启时提示这个

Stoping LNMP...
Stoping nginx... nginx: [emerg] 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-fpm  done
6#
发表于 2017-8-8 11:57:42 | 只看该作者
12345.com 能卖海景房的钱吧
7#
 楼主| 发表于 2017-8-9 07:25:47 | 只看该作者
有知道针对最新版的DZ 应如何添加规则么
8#
发表于 2017-8-9 07:38:50 | 只看该作者
阳光淡蓝 发表于 2017-8-8 11:54
谢谢,但重启时提示这个

Stoping LNMP...

你是nginx用什么apache的伪静态配置,
dz后台就可以看到要用的伪静态规则
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-6-17 18:25 , Processed in 0.059802 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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