VPS侦探论坛

 找回密码
 注册
查看: 6744|回复: 1

求Apache规则转换为NGINX

[复制链接]
发表于 2011-9-22 10:35:42 | 显示全部楼层 |阅读模式

# RewriteEngine 模式打开
RewriteEngine On
# 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
RewriteBase /
RewriteCond %{REQUEST_URI} !image/admincp/getcolor.htm$
RewriteRule ^(.*)\.htm$  - [F,L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule .*/(.+).php$ $1.php?%1 [L,NC]
# Rewrite 系统规则请勿修改
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1 [L,NC] RewriteCond %{QUERY_STRING} ^(.*)
$RewriteRule article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1 [L,NC]
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule forum-([0-9a-z_]+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1 [L,NC]
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule thread-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1 [L,NC] RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1 [L,NC]
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1 [L,NC]
RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^([a-z]+)-(.+)\.html$ $1.php?rewrite=$2&%1 [L,NC]
## 目录化规则,保留前面的部分可以不影响已经被搜索引擎收录的页面  
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule m([0-9]+)(/([0-9]+))?(/)?$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$5&page=$3&%1 [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([0-9a-z_]+)(/([0-9]+))?(/)?$ forum.php?mod=forumdisplay&fid=$1&page=$3&%1 [L,NC]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-9-22 12:44:21 | 显示全部楼层


discuz的伪静态,lnmp里就带了,/root/vhost.sh添加的时候,按提示输入就行了。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-21 08:33 , Processed in 0.025004 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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