在网站根目录下新建一个.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. java第四天

    p32~p36: 学习javadoc 1.第一步,打开一个一定规模的java项目 2.第二步,搭建测试环境 IntelliJ IDEA ——> Tools ——> Generate Jav ...

  2. 《Java入门第二季》第五章 阶段练习

    /** * ┏┓ ┏┓ * ┏┛┻━━━┛┻┓ * ┃ ┃ * ┃ ━ ┃ * ┃ > < ┃ * ┃ ┃ * ┃... ⌒ ... ┃ * ┃ ┃ * ┗━┓ ┏━┛ * ┃ ┃ Cod ...

  3. 端口安全检查shell脚本

    #!/bin/bash #This script name is scan_analyse.sh . /etc/profile echo "start time is $(date)&quo ...

  4. nw.js node-webkit系列(18)怎么对.js进行编译以防你的代码暴露出来

    原文链接:http://blog.csdn.net/zeping891103/article/details/50819102 参考:https://segmentfault.com/a/119000 ...

  5. android的hook方面知识点

    android hook分为另种: native层hook---理解ELF文件 java层---虚拟机特性和Java上的反射的作用 注入代码: 存放在哪? 用mmap函数分配临时内存来完成代码存放,对 ...

  6. VC++使用FindFirstFile,FindNextFile遍历一个文件夹

    转载:http://www.cnblogs.com/chenkunyun/archive/2012/03/24/2415727.html 方法一. //遍历文件夹函数 void TraverseFol ...

  7. HDU 1317 XYZZY(floyd+bellman_ford判环)

    http://acm.hdu.edu.cn/showproblem.php?pid=1317 题意: 给出一个有向图,每到达一个点,都会加上或减去一些能量,我们要做的就是判断从1出发是否能到达n.初始 ...

  8. Codeforces Round #275 (Div. 2) A,B,C,D

    A. Counterexample time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  9. MQ是什么 RabbitMQ

    一.rabbitMQ是什么: RabbitMQ,遵循AMQP协议,由内在高并发的erlanng语言开发,用在实时的对可靠性要求比较高的消息传递上. 学过websocket的来理解rabbitMQ应该是 ...

  10. c# 如何调用python脚本

    1.net4.5: http://www.jb51.net/article/84418.htm 2.net4.0: https://www.cnblogs.com/shiyingzheng/p/605 ...