博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
apache伪静态设置
阅读量:7033 次
发布时间:2019-06-28

本文共 3500 字,大约阅读时间需要 11 分钟。

在网站根目录下新建一个.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=$1RewriteRule ^w-([A-Za-z0-9_]+)-news.html$ website.php?action=news&website=$1RewriteRule ^w-([A-Za-z0-9_]+)-xinwen.html$ website.php?action=news&website=$1&category_id=7RewriteRule ^w-([A-Za-z0-9_]+)-huodong.html$ website.php?action=news&website=$1&category_id=8RewriteRule ^w-([A-Za-z0-9_]+)-meiti.html$ website.php?action=news&website=$1&category_id=9RewriteRule ^w-([A-Za-z0-9_]+)-gonglue.html$ website.php?action=news&website=$1&category_id=10RewriteRule ^w-([A-Za-z0-9_]+)-news-page-([0-9]+).html$ website.php?action=news&website=$1&page=$2RewriteRule ^w-([A-Za-z0-9_]+)-news-([0-9]+).html$ website.php?action=art&website=$1&content_id=$2RewriteRule ^w-([A-Za-z0-9_]+)-ziliao.html$ website.php?action=ziliao&website=$1RewriteRule ^w-([A-Za-z0-9_]+)-ziliao-page-([0-9]+).html$ website.php?action=ziliao&website=$1&page=$2RewriteRule ^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=$1RewriteRule ^news-([0-9]+)-p([0-9]+).html$ news.php?id=$1&page=$2RewriteRule ^content-([0-9]+).html$ content.php?id=$1RewriteRule ^content-([0-9]+)-([0-9]+).html$ content.php?id=$1&page=$2RewriteRule ^c/([A-Za-z0-9_]+).html$ game.php?action=guildstart&myworld=$1RewriteRule ^index.html$ index.phpRewriteRule ^game.html$ game.phpRewriteRule ^kaif.html$ kaif.phpRewriteRule ^user.html$ user.phpRewriteRule ^pay.html$ pay.phpRewriteRule ^card.html$ card.phpRewriteRule ^reg.html$ reg.phpRewriteRule ^about.html$ about.php?a=1RewriteRule ^login.html$ login.php#404页面RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule .? /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扩展名的文件
Order allow,denyDeny from all
#discuz 3.3伪静态规则RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3&%1RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&%1RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3&%1RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html$ $1/archiver/index.php?action=$2&value=$3&%1RewriteCond %{QUERY_STRING} ^(.*)$RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3&%1

 

转载于:https://www.cnblogs.com/as3lib/p/6617410.html

你可能感兴趣的文章
如何处理Express异常
查看>>
Cycle.js 状态管理模型
查看>>
[译]Effective Kotlin系列之考虑使用原始类型的数组优化性能(五)
查看>>
为什么我从 Google 辞职而为自己工作
查看>>
技术问答集锦(四)
查看>>
针对虚拟机搭建centos7不能上网问题处理方法
查看>>
React 源码分析
查看>>
JavaScript 算法之复杂度分析
查看>>
第六章——函数(inout参数与变异方法)
查看>>
掘金翻译计划月报 — 2018 年 2 月
查看>>
Android属性动画
查看>>
渐进式Express源码学习5-全副武装
查看>>
JVM难学?那是因为你没认真看完这篇文章
查看>>
python面试题(五)
查看>>
老司机 iOS 周报 #40 | 2018-10-22
查看>>
VirtualView iOS 模板加载功能实现详解
查看>>
这可能是最好的性能优化教程(二)
查看>>
被马化腾点赞的微信车票设计,背后有哪些故事?
查看>>
Spring理论基础-面向切面编程
查看>>
BloomFilter 原理,实现及优化
查看>>