在网站根目录下新建一个.htaccess文件即可,编辑如下
RewriteEngine On
#游戏列表详细介绍
RewriteRule ^g-([0-9]+).html$ game.php?action=gamelist_desc&game_id=$1
#游戏开服表
RewriteRule ^serverlist-([0-9]+).html$ website.php?action=server_list&game_id=$1
#游戏官网伪静态
RewriteRule ^w-([A-Za-z0-9_]+).html$ website.php?website=$1
RewriteRule ^w-([A-Za-z0-9_]+)-news.html$ website.php?action=news&website=$1
RewriteRule ^w-([A-Za-z0-9_]+)-xinwen.html$ website.php?action=news&website=$1&category_id=7
RewriteRule ^w-([A-Za-z0-9_]+)-huodong.html$ website.php?action=news&website=$1&category_id=8
RewriteRule ^w-([A-Za-z0-9_]+)-meiti.html$ website.php?action=news&website=$1&category_id=9
RewriteRule ^w-([A-Za-z0-9_]+)-gonglue.html$ website.php?action=news&website=$1&category_id=10
RewriteRule ^w-([A-Za-z0-9_]+)-news-page-([0-9]+).html$ website.php?action=news&website=$1&page=$2
RewriteRule ^w-([A-Za-z0-9_]+)-news-([0-9]+).html$ website.php?action=art&website=$1&content_id=$2
RewriteRule ^w-([A-Za-z0-9_]+)-ziliao.html$ website.php?action=ziliao&website=$1
RewriteRule ^w-([A-Za-z0-9_]+)-ziliao-page-([0-9]+).html$ website.php?action=ziliao&website=$1&page=$2
RewriteRule ^w-([A-Za-z0-9_]+)-ziliao-([0-9]+).html$ website.php?action=art&website=$1&content_id=$2
#新闻伪静态
RewriteRule ^news-([0-9]+).html$ news.php?id=$1
RewriteRule ^news-([0-9]+)-p([0-9]+).html$ news.php?id=$1&page=$2
RewriteRule ^content-([0-9]+).html$ content.php?id=$1
RewriteRule ^content-([0-9]+)-([0-9]+).html$ content.php?id=$1&page=$2
RewriteRule ^c/([A-Za-z0-9_]+).html$ game.php?action=guildstart&myworld=$1
RewriteRule ^index.html$ index.php
RewriteRule ^game.html$ game.php
RewriteRule ^kaif.html$ kaif.php
RewriteRule ^user.html$ user.php
RewriteRule ^pay.html$ pay.php
RewriteRule ^card.html$ card.php
RewriteRule ^reg.html$ reg.php
RewriteRule ^about.html$ about.php?a=1
RewriteRule ^login.html$ login.php #404页面
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .? /404.php [L]
#不允许直接访问 下面目录下的php文件
RewriteCond % !^$
RewriteRule api/(.*).(php)$ – [F]
RewriteRule config/(.*).(php)$ – [F]
RewriteRule ebak/(.*).(php)$ – [F]
RewriteRule hi_ports/(.*).(php)$ – [F]
RewriteRule includes/(.*).(php)$ – [F]
RewriteRule pay/(.*).(php)$ – [F]
RewriteRule templates/(.*).(php)$ –[F]
RewriteRule uploads/(.*).(php)$ – [F]
#不允许访问 .inc .txt .sql .conf扩展名的文件
<Files ~ "\.(inc|txt|sql|conf)$">
Order allow,deny
Deny from all
</Files> #discuz 3.3伪静态规则
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html$ $1/archiver/index.php?action=$2&value=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3&%1

apache伪静态设置的更多相关文章

  1. Nginx/Apache之伪静态设置 - 运维小结

    一.什么是伪静态伪静态即是网站本身是动态网页如.php..asp..aspx等格式动态网页有时这类动态网页还跟"?"加参数来读取数据库内不同资料,伪静态就是做url重写操作(即re ...

  2. Phpcms V9全站伪静态设置方法

    为什么要伪静态?具体在这里就不说了,你懂的!一方面更新修改后不需要生成静态文件,另一方面为了SEO! 访问规则如下 1 2 list-{$catid}-{$page}.html content-{$c ...

  3. 利用apache伪静态技术防止盗链

    (在我们制作网站的过程中,可能会遇到这样的问题,就是其他的网站直接盗用了我们网站的图片或css或js,这样可能会大大增加我们自己网站的负载. 所以,我们应该考虑一下怎样防止这样的事情发生.) 下面我们 ...

  4. apache伪静态规则解析

    apache伪静态规则解析 最近有个客户有个要求,昨天折腾了一会,没解决,今天没啥就多学习学习 还是根据例子来学习比较快 1 简单的重定向规则 RewriteEngine On //启动规则 Rewr ...

  5. 帝国cms伪静态设置方法(收藏)

    众所周知,动态页面不利于收录和排名.伪静态可以完美的解决这问题,配合百度云加速CDN,可以让动态页面有静态页面一样快的访问速度. 今天开拓族给大家带来帝国CMS伪静态的详细设置方法. 1.栏目设置为动 ...

  6. 帝国cms伪静态设置方法

    众所周知,动态页面不利于收录和排名.伪静态可以完美的解决这问题,配合百度云加速CDN,可以让动态页面有静态页面一样快的访问速度. 今天开拓族给大家带来帝国CMS伪静态的详细设置方法. 1.栏目设置为动 ...

  7. 如何在 apache 中设置缓存有效时间

    今天学习了下如何在 apache 中设置缓存时间,记之以备忘. 在 http 报文头中,与缓存时间有关的两个字段是 Expires 以及 Cache-Control 中的 max-age,Expire ...

  8. Ecshop导航栏标题栏的伪静态设置

    当Ecshop的伪静设置成功之后,左侧的分类标签,包括具体的产品页面都可以顺利的打开伪静态页面,但是点击导航栏,或者标题栏的时候,却还是之前的数据库标签页的方式,这是怎么一回事呢? 这是由于,Ecsh ...

  9. apache访问控制设置

    apache访问控制设置 (2009-03-17 11:24:36) 转载▼ 标签: it 杂谈   Order allow,deny    默认情况下禁止所有客户机访问 Order deny,all ...

随机推荐

  1. 20155334 2016-2017-2 《Java程序设计》第七周学习总结

    20155334 2016-2017-2 <Java程序设计>第七周学习总结 教材学习内容总结 第十二章:Lambda 认识Lammbda语法 Lambda去可以重复,符合DRY原则,而且 ...

  2. python使用zipfile解压中文乱码问题

    在zipfile.ZipFile中获得的filename有中日文则很大可能是乱码,这是因为 在zip标准中,对文件名的 encoding 用的不是 unicode,而可能是各种软件根据系统的默认字符集 ...

  3. 微信小程序:JS 交互逻辑

    微信小程序:JS 交互逻辑 一.JS 交互逻辑 一个服务仅仅只有界面展示是不够的,还需要和用户做交互:响应用户的点击.获取用户的位置等等.在小程序里边,我们就通过编写 JS 脚本文件来处理用户的操作. ...

  4. 微信小程序:工具配置 project.config.json

    微信小程序:工具配置 project.config.json 一.项目配置文件project.config.json 小程序开发者工具在每个项目的根目录都会生成一个 project.config.js ...

  5. supervisor初试

    Supervisor (http://supervisord.org) 是一个用 Python 写的进程管理工具,可以很方便的用来启动.重启.关闭进程(不仅仅是 Python 进程).除了对单个进程的 ...

  6. LINUX实践--ELF分析

    一.ELF文件头(定义在/usr/include/elf.h)中 二.实践部分 第一行 对应e_ident[EI_NIDENT]:实际表示内容为7f45 4c46 0101 0100 0000 000 ...

  7. HeyWeGo小组《Java程序设计》 2015—2016年学期团队项目总结

    HeyWeGo小组<Java程序设计> 2015—2016年学期团队项目总结 题目简介 一个简单的扫雷小游戏,在12*12的方格盘上,首先可以设定雷的个数,然后点击开始程序就会随机布雷,开 ...

  8. 强连通分量(Korasaju & Tarjan)学习笔记

    好久以前学过的东西...现在已经全忘了 很多图论问题需要用到强连通分量,还是很有必要重新学一遍的 强连通分量(Strongly Connected Component / SCC) 指在一个有向图中, ...

  9. Coursera SDN M1.2.1 SDN History: Programmable Networks 1

    接上第二点 NOTE (2)active networks => Programmability in networks(1990s) Sturcture: What are active ne ...

  10. HDU 4616 Game(经典树形dp+最大权值和链)

    http://acm.hdu.edu.cn/showproblem.php?pid=4616 题意:给出一棵树,每个顶点有权值,还有存在陷阱,现在从任意一个顶点出发,并且每个顶点只能经过一次,如果经过 ...