·设为首页收藏本站📧邮箱修改🎁免费下载专区📒收藏夹👽聊天室📱AI智能体
返回列表 发布新帖

①文章标签 伪静态版IIS/APACHE/Nginx伪静态规则

379 2
发表于 2021-11-8 09:12:06 | 查看全部 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
伪静态规则,放在其它DZ规则的上面,如:thread规则这一行上面

# IIS/APACHE Web Server 1                                                         
RewriteRule ^(.*)/tag(_([0-9]+))?(/|\.html)?$ $1/plugin\.php\?id=onexin_tags&page=$3&%1
RewriteRule ^(.*)/tag-(\d+)(-(\d+))?(/|\.html)?$ $1/plugin\.php\?id=onexin_tags&tagid=$2&page=$4&%1
RewriteRule ^(.*)/tag/([^\/\.]+)(/(\d+))?(/|\.html)?$ $1/plugin\.php\?id=onexin_tags&tagname=$2&page=$4&%1

# IIS/APACHE Web Server 2                                                           
RewriteRule ^tag(_([0-9]+))?(/|\.html)?$ plugin.php?id=onexin_tags&page=$2&%1      
RewriteRule ^tag-(\d+)(-(\d+))?(/|\.html)?$ plugin.php?id=onexin_tags&tagid=$1&page=$3&%1         
RewriteRule ^tag/([^\/\.]+)(/(\d+))?(/|\.html)?$ plugin.php?id=onexin_tags&tagname=$1&page=$3&%1

# Nginx Web Server            
rewrite ^([^\.]*)/tag(_([0-9]+))?(/|\.html)?$ $1/plugin.php?id=onexin_tags&page=$3 last;
rewrite ^([^\.]*)/tag-(\d+)(-(\d+))?(/|\.html)?$ $1/plugin.php?id=onexin_tags&tagid=$2&page=$4 last;
rewrite ^([^\.]*)/tag/([^\/\.]+)(/(\d+))?(/|\.html)?$ $1/plugin.php?id=onexin_tags&tagname=$2&page=$4 last;

# IIS 7.x及以上 Web Server(独立主机用户)
<rule name="onexin_tag_1">
<match url="^(.*/)*tag(_([0-9]+))?(/|\.html)?$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=onexin_tags&amp;page={R:3}" />
</rule>
<rule name="onexin_tag_2">
<match url="^(.*/)*tag-(\d+)(-(\d+))?(/|\.html)?$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=onexin_tags&amp;tagid={R:2}&amp;page={R:4}" />
</rule>
<rule name="onexin_tag_3">
<match url="^(.*/)*tag/([^\/\.]+)(/(\d+))?(/|\.html)?$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=onexin_tags&amp;tagname={R:2}&amp;page={R:4}" />
</rule>

=================网址说明=============================
旧规则
http://demo.onexin.com/tag.html
http://demo.onexin.com/tag-110.html

新规则(推荐目录化写法)
http://demo.onexin.com/tag/
http://demo.onexin.com/tag/影响力/
我要说一句 收起回复
一花一世界,一叶一追寻。一曲一场叹,一生为一人。

评论2

GM-爱好者Lv.2 发表于 2021-11-30 11:41:37 | 查看全部

我看不错噢 谢谢楼主!dz插件网越来越好!
我要说一句 收起回复
Discuz智能体Lv.8 发表于 2025-3-21 08:20:34 | 查看全部
根据你提供的伪静态规则,以下是对这些规则的详细解释和优化建议:

### 1. **IIS/APACHE Web Server 1**
  1. RewriteRule ^(.*)/tag(_(+))?(/|\.html)?$ $1/plugin\.php\?id=onexin_tags&page=$3&%1
  2. RewriteRule ^(.*)/tag-(\d+)(-(\d+))?(/|\.html)?$ $1/plugin\.php\?id=onexin_tags&tagid=$2&page=$4&%1
  3. RewriteRule ^(.*)/tag/(+)(/(\d+))?(/|\.html)?$ $1/plugin\.php\?id=onexin_tags&tagname=$2&page=$4&%1
复制代码


- **第一条规则**:匹配形如 `http://demo.onexin.com/tag.html` 或 `http://demo.onexin.com/tag_2.html` 的URL,并将其重写为 `plugin.php?id=onexin_tags&page=2`。
- **第二条规则**:匹配形如 `http://demo.onexin.com/tag-110.html` 或 `http://demo.onexin.com/tag-110-2.html` 的URL,并将其重写为 `plugin.php?id=onexin_tags&tagid=110&page=2`。
- **第三条规则**:匹配形如 `http://demo.onexin.com/tag/影响力/` 或 `http://demo.onexin.com/tag/影响力/2.html` 的URL,并将其重写为 `plugin.php?id=onexin_tags&tagname=影响力&page=2`。

### 2. **IIS/APACHE Web Server 2**
  1. RewriteRule ^tag(_(+))?(/|\.html)?$ plugin.php?id=onexin_tags&page=$2&%1      
  2. RewriteRule ^tag-(\d+)(-(\d+))?(/|\.html)?$ plugin.php?id=onexin_tags&tagid=$1&page=$3&%1         
  3. RewriteRule ^tag/(+)(/(\d+))?(/|\.html)?$ plugin.php?id=onexin_tags&tagname=$1&page=$3&%1
复制代码


- **第一条规则**:匹配形如 `http://demo.onexin.com/tag.html` 或 `http://demo.onexin.com/tag_2.html` 的URL,并将其重写为 `plugin.php?id=onexin_tags&page=2`。
- **第二条规则**:匹配形如 `http://demo.onexin.com/tag-110.html` 或 `http://demo.onexin.com/tag-110-2.html` 的URL,并将其重写为 `plugin.php?id=onexin_tags&tagid=110&page=2`。
- **第三条规则**:匹配形如 `http://demo.onexin.com/tag/影响力/` 或 `http://demo.onexin.com/tag/影响力/2.html` 的URL,并将其重写为 `plugin.php?id=onexin_tags&tagname=影响力&page=2`。

### 3. **Nginx Web Server**
  1. rewrite ^(*)/tag(_(+))?(/|\.html)?$ $1/plugin.php?id=onexin_tags&page=$3 last;
  2. rewrite ^(*)/tag-(\d+)(-(\d+))?(/|\.html)?$ $1/plugin.php?id=onexin_tags&tagid=$2&page=$4 last;
  3. rewrite ^(*)/tag/(+)(/(\d+))?(/|\.html)?$ $1/plugin.php?id=onexin_tags&tagname=$2&page=$4 last;
复制代码


- **第一条规则**:匹配形如 `http://demo.onexin.com/tag.html` 或 `http://demo.onexin.com/tag_2.html` 的URL,并将其重写为 `plugin.php?id=onexin_tags&page=2`。
- **第二条规则**:匹配形如 `http://demo.onexin.com/tag-110.html` 或 `http://demo.onexin.com/tag-110-2.html` 的URL,并将其重写为 `plugin.php?id=onexin_tags&tagid=110&page=2`。
- **第三条规则**:匹配形如 `http://demo.onexin.com/tag/影响力/` 或 `http://demo.onexin.com/tag/影响力/2.html` 的URL,并将其重写为 `plugin.php?id=onexin_tags&tagname=影响力&page=2`。

### 4. **IIS 7.x及以上 Web Server(独立主机用户)**
对于IIS 7.x及以上版本,你可以使用以下规则:

  1. <rule name="Tag Rule 1" stopProcessing="true">
  2.     <match url="^(.*)/tag(_(+))?(/|\.html)?$" />
  3.     <action type="Rewrite" url="{R:1}/plugin.php?id=onexin_tags&page={R:3}&{QUERY_STRING}" />
  4. </rule>
  5. <rule name="Tag Rule 2" stopProcessing="true">
  6.     <match url="^(.*)/tag-(\d+)(-(\d+))?(/|\.html)?$" />
  7.     <action type="Rewrite" url="{R:1}/plugin.php?id=onexin_tags&tagid={R:2}&page={R:4}&{QUERY_STRING}" />
  8. </rule>
  9. <rule name="Tag Rule 3" stopProcessing="true">
  10.     <match url="^(.*)/tag/(+)(/(\d+))?(/|\.html)?$" />
  11.     <action type="Rewrite" url="{R:1}/plugin.php?id=onexin_tags&tagname={R:2}&page={R:4}&{QUERY_STRING}" />
  12. </rule>
复制代码


### 5. **网址说明**
- **旧规则**:
  - `http://demo.onexin.com/tag.html`
  - `http://demo.onexin.com/tag-110.html`

- **新规则(推荐目录化写法)**:
  - `http://demo.onexin.com/tag/`
  - `http://demo.onexin.com/tag/影响力/`

### 6. **优化建议**
- **URL规范化**:建议统一使用目录化的URL结构,如 `http://demo.onexin.com/tag/影响力/`,这样更符合SEO优化。
- **缓存策略**:可以考虑为这些URL设置缓存策略,以提高页面加载速度。
- **错误处理**:确保在URL参数错误或缺失时,能够正确处理并返回404页面或其他友好提示。

如果你有更多问题或需要进一步的帮助,请随时联系我!
-- 本回答由 人工智能 AI智能体 生成,内容仅供参考,请仔细甄别。
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

图文热点
关闭

站长推荐上一条 /1 下一条

AI智能体
投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图 知道创宇云防御

您的IP:3.15.137.45,GMT+8, 2025-4-1 04:23 , Processed in 0.222553 second(s), 88 queries , Gzip On, Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2025 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表