http://blog.csdn.net/u014181418/article/details/53467980

1、在论坛代码目录下新建文件“.htaccess”

vim /usr/share/nginx/html/bbs/.htaccess //bbs下放置着我的论坛代码

2、在文件“.htaccess”里添加伪静态规则

# nginx rewrite rule
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.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-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
# end nginx rewrite rule

3、配置到nginx文件

vim /etc/nginx/nginx.conf
    server {
listen 80;
listen localhost;
server_name _;
root /usr/share/nginx/html/bbs;
include /usr/share/nginx/html/bbs/.htaccess; #引入文件“.htaccess” location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}

4、重启服务

/usr/sbin/nginx -s reload

Discuz论坛URL静态化规则urlrewrite的更多相关文章

  1. PHP 404页面/如何设置404页面/URL静态化/URL伪静态化

    php中如何设置404页面及其他错误页面 首先在项目根目录下新建文件,文件名为" .htaccess " 在该文件中写入一下配置项: ErrorDocument 404 /404. ...

  2. 如何做URL静态化 和页面的静态化

    为什么要进行URL静态化? 如果帮到了您,您可以小支持一下,谢谢您   1.更好的迎合搜索引擎工作原理的爬行抓取机制:2.把网站URL静态化更有助于网站获得好的排名:3.URL静态化有利于用户体验.不 ...

  3. winserver 2008 r2 iis7.5 实现php wordpress url静态化操作步骤(UrlRewrite实现)

    参考网址:http://jingyan.baidu.com/article/cbf0e500ebec582eaa2893d2.html 文中涉及到的程序源码以及配置 详见附件:http://files ...

  4. windows2008(64位)下iis7.5中的url伪静态化重写(urlrewrite)

    以前在windows2003里,使用的是iis6.0,那时常使用的URL重写组件是iisrewrite,当服务器升级到windows2008R2时,IIS成了64位的7.5,结果iisreite组件是 ...

  5. Ecshop:ecshop nginx下实现url静态化

    1.在nginx/conf/tuwen.com.conf中添加: include ecshop.conf; 2.编辑nginx/ecshop.conf: location / { rewrite &q ...

  6. 20、wordpress博客url静态化

    20.1 wordpress没有实现伪静态时的网页: 20.2进入wordpress后台: 1.设置 2.固定链接 3.自定义链接 /archives/%post_id%.html #%post_id ...

  7. JSP页面静态化总结之一使用URLRewrite实现url地址伪静态化

    JSP页面静态化总结之一使用URLRewrite实现url地址伪静态化 1使用URLRewrite实现url地址伪静态化1.1URLRewirte的用处 1.满足搜索引擎的要求. 2.隐藏技术实现,提 ...

  8. 为什么网站URL需要设置为静态化

    http://www.wocaoseo.com/thread-95-1-1.html       为什么网站URL需要静态化?网站url静态化的好处是什么?现在很多网站的链接都是静态规的链接,但是网站 ...

  9. Linux 下Discuz论坛的搭建

    Discuz论坛的搭建[基于LNMP环境搭建成功后] ##创建BBS数据库在本地/远程服务器 mysql -uroot -proot create database bbs; show databas ...

随机推荐

  1. jQuery 属性(十二)

    属性 描述 context 在版本 1.10 中被弃用.包含传递给 jQuery() 的原始上下文. jquery 包含 jQuery 版本号. jQuery.fx.interval 改变以毫秒计的动 ...

  2. Tsung:开源多协议分布式负载&压力测试工具

    Main features High Performance: the load can be distributed on a cluster of client machines Multi-pr ...

  3. IE8及其以下浏览器关于圆角表框的问题

    css部分 yuan { border: 2px solid #C0C0C0; -moz-border-radius: 50%; -webkit-border-radius: 50%; border- ...

  4. Python(三)字典的增删改查和遍历

    一.增加

  5. 在阿里云 ECS 搭建 nginx https nodejs 环境(二、https)

    在阿里云 ECS 搭建 nginx https nodejs 环境(二) 这次主要内容是 如何在 ubuntu 的nginx 下配置 二级域名. 一. 域名解析 首先你需要去到你的 域名服务商那边 进 ...

  6. 自学Aruba2.3-Aruba Web UI --Configuration面板介绍

    点击返回:自学Aruba之路 自学Aruba2.3-Aruba Web UI --Configuration面板介绍 此文只展示重要面板,大部分通俗易懂就不过多语言介绍, 后期配置实例中再结合理论知识 ...

  7. CSS根据子元素个数不同定义样式

    近日面试,遇见了一个这样的问题,不会,便记下来. 问题:如何根据子元素个数的不同定义不同的样式? 代码:HTML <ul> <li>1</li> <li> ...

  8. 使用神经网络来拟合函数y = x^3 +b

    我们使用一个三层的小网络来,模拟函数y = x^3+b函数 import tensorflow as tf import numpy as np import matplotlib.pyplot as ...

  9. Java内存管理及对Java对象管理

    Java内存管理及对Java对象管理 1Java内存管理 1.1Java中的堆和栈 通常来说,人们会将Java内存氛围栈内存(Stack)和堆内存(Heap). 栈内存用来保存基本类型的变量和对象的引 ...

  10. [搬运] C# 这些年来受欢迎的特性

    原文地址:http://www.dotnetcurry.com/csharp/1411/csharp-favorite-features 在写这篇文章的时候,C# 已经有了 17 年的历史了,可以肯定 ...