当前位置:首页 > 技术分享

35DIR伪静态

2年前 (2024-10-12)技术分享885

Apache

<IfModule mod_rewrite.c>
RewriteEngine On
# BEGIN
# 首页、分类浏览、数据归档、最近更新、排行榜、意见反馈
RewriteRule ^(index|webdir|weblink|article|category|update|archives|top|feedback|link|rssfeed|sitemap)(\/?)$ index.php\?mod=$1
# 最近更新
RewriteRule ^update/(\d+)-(\d+)\.html$ index.php?mod=update&days=$1&page=$2
RewriteRule ^update/(\d+)\.html$ index.php?mod=update&days=$1
# 数据归档
RewriteRule ^archives/(\d+)-(\d+)\.html$ index.php?mod=archives&date=$1&page=$2
RewriteRule ^archives/(\d+)\.html$ index.php?mod=archives&date=$1
# 站内搜索
RewriteRule ^search/(name|url|tags|intro)/(.+)-(\d+)\.html$ index.php?mod=search&type=$1&query=$2&page=$3
RewriteRule ^search/(name|url|tags|intro)/(.+)\.html$ index.php?mod=search&type=$1&query=$2
# 站点详细
RewriteRule ^siteinfo/(\d+)\.html$ index.php?mod=siteinfo&wid=$1
# 文章详细
RewriteRule ^artinfo/(\d+)\.html$ index.php?mod=artinfo&aid=$1
# 链接列表
RewriteRule ^weblink/(\d+)\.html$ index.php?mod=weblink&page=$1
# 链接详细
RewriteRule ^linkinfo/(\d+)\.html$ index.php?mod=linkinfo&lid=$1
# 单页
RewriteRule ^diypage/(\d+)\.html$ index.php?mod=diypage&pid=$1
# RSS
RewriteRule ^rssfeed/(webdir|article)-(\d+)\.html$ index.php?mod=rssfeed&type=$1&cid=$2
RewriteRule ^rssfeed/(webdir|article)\.html$ index.php?mod=rssfeed&type=$1
RewriteRule ^rssfeed\/(.+)/$ index.php\?mod=rssfeed&type=$1
RewriteRule ^rssfeed\/(.+)/(\d+)\.html$ index.php\?mod=rssfeed&type=$1&cid=$2
RewriteRule ^rssfeed\/(.+)$ index.php\?mod=rssfeed&type=$1
RewriteRule ^rssfeed\/(.+)/(\d+)$ index.php\?mod=rssfeed&type=$1&cid=$2
# SiteMap
RewriteRule ^sitemap/(webdir|article)-(\d+)\.html$ index.php?mod=sitemap&type=$1&cid=$2
RewriteRule ^sitemap/(webdir|article)\.html$ index.php?mod=sitemap&type=$1
# 分类目录
RewriteRule ^webdir-(.+)-(\d+)-(\d+)\.html$ index.php\?mod=webdir&cid=$2&page=$3
RewriteRule ^webdir\/(.+)\/(\d+)-(\d+)\.html$ index.php\?mod=webdir&cid=$2&page=$3
RewriteRule ^webdir\/(.+)\/(\d+)/(\d+)$ index.php\?mod=webdir&cid=$2&page=$3
RewriteRule ^article-(.+)-(\d+)-(\d+)\.html$ index.php\?mod=article&cid=$2&page=$3
RewriteRule ^article\/(.+)\/(\d+)-(\d+)\.html$ index.php\?mod=article&cid=$2&page=$3
RewriteRule ^article\/(.+)\/(\d+)/(\d+)$ index.php\?mod=article&cid=$2&page=$3
# END

</IfModule>


Nginx

rewrite ^/(index|webdir|weblink|article|category|update|archives|top|feedback|link|rssfeed|sitemap)(/?)$ /index.php?mod=$1;
rewrite ^/update/(\d+)\.html$ /index.php?mod=update&days=$1;
rewrite ^/update/(\d+)-(\d+)\.html$ /index.php?mod=update&days=$1&page=$2;
rewrite ^/archives/(\d+)\.html$ /index.php?mod=archives&date=$1;
rewrite ^/archives/(\d+)-(\d+)\.html$ /index.php?mod=archives&date=$1&page=$2;
rewrite ^/search/(name|url|tags|intro|br|pr|art)/(.+)-(\d+)\.html$ /index.php?mod=search&type=$1&query=$2&page=$3;
rewrite ^/search/(name|url|tags|intro|br|pr|art)/(.+)\.html$ /index.php?mod=search&type=$1&query=$2;
rewrite ^/(br|pr)/(.+)-(\d+)\.html$ /index.php?mod=search&type=$1&query=$2&page=$3;
rewrite ^/(br|pr)/(.+)\.html$ /index.php?mod=search&type=$1&query=$2;
rewrite ^/view/(\d+)\.html$ /index.php?mod=siteinfo&wid=$1;
rewrite ^/siteinfo/(\d+)\.html$ /index.php?mod=siteinfo&wid=$1;
rewrite ^/siteinfo-(\d+)\.html$ /index.php?mod=siteinfo&wid=$1;
rewrite ^/site/(\d+)-(.+)(/?)\.html$ /index.php?mod=siteinfo&wid=$1;
rewrite ^/artinfo/(\d+)\.html$ /index.php?mod=artinfo&aid=$1;
rewrite ^/linkinfo/(\d+)\.html$ /index.php?mod=linkinfo&lid=$1;
rewrite ^/diypage/(\d+)\.html$ /index.php?mod=diypage&pid=$1;
rewrite ^/rssfeed/(\d+)\.html$ /index.php?mod=rssfeed&cid=$1;
rewrite ^/sitemap/(\d+)\.html$ /index.php?mod=sitemap&cid=$1;
rewrite ^/webdir/(.+)/(\d+)\.html$ /index.php?mod=webdir&cid=$2;
rewrite ^/webdir/(.+)/(\d+)-(\d+)\.html$ /index.php?mod=webdir&cid=$2&page=$3;
rewrite ^/webdir/(.+)/(\d+)-(.+)-(\d+)\.html$ /index.php?mod=webdir&cid=$2&sort=$3&page=$4;
rewrite ^/weblink/(.+)/(\d+)\.html$ /index.php?mod=weblink&cid=$2;
rewrite ^/weblink/(.+)/(\d+)-(\d+)\.html$ /index.php?mod=weblink&cid=$2&page=$3;
rewrite ^/weblink/(.+)/(\d+)-(.+)-(\d+)\.html$ /index.php?mod=weblink&cid=$2&sort=$3&page=$4;
rewrite ^/article/(.+)/(\d+)\.html$ /index.php?mod=article&cid=$2;
rewrite ^/article/(.+)/(\d+)-(\d+)\.html$ /index.php?mod=article&cid=$2&page=$3;
rewrite ^/rssfeed/webdir/ /index.php?mod=rssfeed&type=webdir;
rewrite ^/rssfeed/article/ /index.php?mod=rssfeed&type=article;
rewrite ^/rssfeed/(.+)/(\d+)\.html$ /index.php?mod=rssfeed&cid=$2;
rewrite ^/rssfeed/(.+)/(\d+)/(\d+)\.html$ /index.php?mod=rssfeed&cid=$2&page=$3;
rewrite ^/rssfeed/(.+)/(\d+)-(\d+)\.html$ /index.php?mod=rssfeed&cid=$2&page=$3;


扫描二维码在手机访问。

版权声明:本文由明乐 iMLDM发布,如需转载请注明出处。

本文链接:https://www.imldm.com/p/1.html

标签: 35DIR伪静态

“35DIR伪静态” 的相关文章

网站禁止搜索引擎结果页被抓取的方法

在搜索引擎(例如百度,谷歌等)中看到一些网站的页面被搜索了大量的垃圾信息页面,其中一些搜索结果页还被索引,这些垃圾信息一旦被索引,就有可能被收录。如果不想搜索结果页面被收录的话,可以使用robots.txt和Robots Meta告诉搜索引擎不索引这些搜索结果页。一般 SEO 用的是robots.t…

有什么好用免费的采集器?

市面上有许多强大且免费的采集器(也称为网络爬虫工具),适合不同技术背景的用户。我将它们分为几类,你可以根据自己的需求选择。一、 可视化/无代码工具 (适合新手、普通用户)这类工具最大的优点是你不需要懂编程,通过点击和简单配置就能抓取数据。八爪鱼采集器特点:国内最知名的采集器之一,功能非常强大,界面友…

对SEO友好URL设置指南

设置对SEO友好的URL规则是网站优化的基础且关键的一步。一个清晰的URL结构不仅有助于搜索引擎更好地理解和排名你的页面,也能提升用户体验和点击率。…

网站改版与域名更换的SEO保护策略

网站改版或更换域名是许多网站发展过程中不可避免的关键节点,然而这个过程中潜藏着巨大的SEO风险。处理不当可能导致搜索引擎排名断崖式下跌,多年积累的流量毁于一旦。本文将为您提供一套完整的解决方案,确保网站平稳过渡,SEO价值得到最大程度的保留。了解不同改版类型的风险与对策改版类型核心风险关键应对措施更…

多款输入法推荐及选择建议

多款输入法推荐及选择建议

选择一款好用的输入法能大大提升打字效率和使用体验。由于每个人的需求和习惯不同,整理了当前主流的几款输入法,你可以根据自己的情况来选择。…

B2B网站SEO终极指南:决胜国内市场与海外市场

对于B2B企业而言,官网不仅是展示窗口,更是核心的销售渠道和品牌阵地。在竞争激烈的线上环境中,搜索引擎优化(SEO)是获取精准客户、降低获客成本的关键。然而,面对不同的市场,SEO的策略也大相径庭。…