admin 发表于 2021-7-4 17:02:03

【三瑞】品牌123默认伪静态规则

切记,品牌123的伪静态要放在
RewriteRule ^(.*)/(+*)-(+)\.html(\?(.*))*$ $1/plugin\.php\?id=$2:$3&$5
之前才能生效。
=============================================
httpd.ini(已认证)
--------------------------------------------------------------------------------------------
RewriteRule ^(.*)/brand\.html(\?(.*))*$ $1/plugin\.php\?id=sanree_brand&$3
RewriteRule ^(.*)/brand-index-(+)-(+)-(+)-(+)\.html(\?(.*))*$ $1/plugin\.php\?id=sanree_brand&mod=list&tid=$2&did=$3&filter=$4&listmode=$5&$6
RewriteRule ^(.*)/brand-(.+)-(+)\.html(\?(.*))*$ $1/plugin\.php\?id=sanree_brand&mod=$2&tid=$3&$5
RewriteRule ^(.*)/b/(+)\.html(\?(.*))*$ $1/plugin\.php\?id=sanree_brand&mod=brandno&tid=$2&$4
==========================================

.htaccess(已认证)
-----------------------------------------------------------------------------------------
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^brand\.html$ plugin.php?id=sanree_brand&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^brand-index-(+)-(+)-(+)-(+)\.html$ plugin.php?id=sanree_brand&mod=list&tid=$1&did=$2&filter=$3&listmode=$4&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^brand-(.+)-(+)\.html$ plugin.php?id=sanree_brand&mod=$1&tid=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^b/(+)\.html$ $1/plugin.php?id=sanree_brand&mod=brandno&tid=$1&%1
==========================================

httpd.conf
===========================================
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)/brand\.html\?*(.*)$ $1/plugin.php?id=sanree_brand&$2
RewriteRule ^(.*)/brand-index-(.+)-(.+)-(.+)-(.+)\.html\?*(.*)$ $1/plugin.php?id=sanree_brand&mod=list&tid=$2&did=$3&filter=$4&listmode=$5&$6
RewriteRule ^(.*)/brand-(.+)-(.+)\.html\?*(.*)$ $1/plugin.php?id=sanree_brand&mod=$2&tid=$3&$5
RewriteRule ^(.*)/b/(.+)\.html\?*(.*)$ $1/plugin.php?id=sanree_brand&mod=brandno&tid=$2&$4
</IfModule>
===============================================
Web.Config(已认证)
===============================================
                <rule name=\"sanree_brand_home\">
                        <match url=\"^(.*/)*brand.html\?*(.*)$\" />
                        <action type=\"Rewrite\" url=\"{R:1}/plugin.php\?id=sanree_brand&{R:2}\" />
                </rule>               
               
                <rule name=\"sanree_brand_cate\">
                        <match url=\"^(.*/)*brand-index-(+)-(+)-(+)-(+).html\?*(.*)$\" />
                        <action type=\"Rewrite\" url=\"{R:1}/plugin.php\?id=sanree_brand&mod=list&tid={R:2}&did={R:3}&filter={R:4}&listmode={R:5}&{R:6}\" />
                </rule>      
               
                <rule name=\"sanree_brand_item\">
                        <match url=\"^(.*/)*brand-(.+)-(+).html\?*(.*)$\" />
                        <action type=\"Rewrite\" url=\"{R:1}/plugin.php\?id=sanree_brand&mod={R:2}&tid={R:3}&{R:4}\" />
                </rule>      
               
                <rule name=\"sanree_brand_short\">
                        <match url=\"^(.*/)*b/(+).html\?*(.*)$\" />
                        <action type=\"Rewrite\" url=\"{R:1}/plugin.php\?id=sanree_brand&mod=brandno&tid={R:2}&{R:3}\" />
                </rule>
      
==============================================
Nginx伪静态规则:
rewrite ^([^\.]*)/brand\.html$ $1/plugin.php?id=sanree_brand last;
rewrite ^([^\.]*)/brand-index-(.+)-(.+)-(.+)-(.+)\.html$ $1/plugin.php?id=sanree_brand&mod=list&tid=$2&did=$3&filter=$4&listmode=$5 last;
rewrite ^([^\.]*)/brand-(.+)-(.+)\.html$ $1/plugin.php?id=sanree_brand&mod=$2&tid=$3 last;
rewrite ^([^\.]*)/b/(.+)\.html$ $1/plugin.php?id=sanree_brand&mod=brandno&tid=$2 last;

Discuz智能体 发表于 2025-3-16 11:28:32

感谢您提供详细的伪静态规则信息。以下是对您提供的伪静态规则的简要说明和优化建议:

### 1. **Apache (.htaccess) 伪静态规则**
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^brand\.html$ plugin.php?id=sanree_brand&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^brand-index-(+)-(+)-(+)-(+)\.html$ plugin.php?id=sanree_brand&mod=list&tid=$1&did=$2&filter=$3&listmode=$4&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^brand-(.+)-(+)\.html$ plugin.php?id=sanree_brand&mod=$1&tid=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^b/(+)\.html$ $1/plugin.php?id=sanree_brand&mod=brandno&tid=$1&%1

**说明:**
- 这些规则用于将用户友好的URL重写为Discuz插件`sanree_brand`的实际处理URL。
- `RewriteCond %{QUERY_STRING} ^(.*)$` 用于捕获查询字符串并将其附加到重写后的URL中。

**优化建议:**
- 确保这些规则放置在`.htaccess`文件的顶部,以避免与其他规则冲突。
- 如果服务器支持,可以考虑将规则直接放置在`httpd.conf`中以提高性能。

### 2. **IIS (Web.Config) 伪静态规则**
<rewrite>
    <rules>
      <rule name="brand">
            <match url="^brand\.html$" />
            <action type="Rewrite" url="plugin.php?id=sanree_brand&{R:1}" />
      </rule>
      <rule name="brand-index">
            <match url="^brand-index-(.+)-(.+)-(.+)-(.+)\.html$" />
            <action type="Rewrite" url="plugin.php?id=sanree_brand&mod=list&tid={R:1}&did={R:2}&filter={R:3}&listmode={R:4}&{R:5}" />
      </rule>
      <rule name="brand-mod">
            <match url="^brand-(.+)-(.+)\.html$" />
            <action type="Rewrite" url="plugin.php?id=sanree_brand&mod={R:1}&tid={R:2}&{R:3}" />
      </rule>
      <rule name="brandno">
            <match url="^b/(.+)\.html$" />
            <action type="Rewrite" url="plugin.php?id=sanree_brand&mod=brandno&tid={R:1}&{R:2}" />
      </rule>
    </rules>
</rewrite>

**说明:**
- 这些规则用于IIS服务器,将用户友好的URL重写为Discuz插件`sanree_brand`的实际处理URL。
- `{R:1}`、`{R:2}`等是捕获组,用于捕获URL中的动态部分。

**优化建议:**
- 确保IIS的URL重写模块已安装并启用。
- 如果规则不生效,检查IIS的日志文件以获取更多信息。

### 3. **Nginx 伪静态规则**
rewrite ^(*)/brand\.html$ $1/plugin.php?id=sanree_brand last;
rewrite ^(*)/brand-index-(.+)-(.+)-(.+)-(.+)\.html$ $1/plugin.php?id=sanree_brand&mod=list&tid=$2&did=$3&filter=$4&listmode=$5 last;
rewrite ^(*)/brand-(.+)-(.+)\.html$ $1/plugin.php?id=sanree_brand&mod=$2&tid=$3 last;
rewrite ^(*)/b/(.+)\.html$ $1/plugin.php?id=sanree_brand&mod=brandno&tid=$2 last;

**说明:**
- 这些规则用于Nginx服务器,将用户友好的URL重写为Discuz插件`sanree_brand`的实际处理URL。
- `last`标志表示这是最后一条匹配的规则。

**优化建议:**
- 确保这些规则放置在Nginx配置文件的`server`块中。
- 如果规则不生效,检查Nginx的错误日志以获取更多信息。

### 4. **通用建议**
- **测试规则**:在应用这些规则之前,建议在测试环境中进行测试,以确保它们按预期工作。
- **缓存**:如果网站流量较大,考虑启用缓存以提高性能。
- **安全性**:确保伪静态规则不会暴露敏感信息或导致安全漏洞。

如果您在应用这些规则时遇到任何问题,欢迎随时联系DZ插件网(https://www.dz-x.net/)获取更多帮助。
-- 本回答由 人工智能 AI智能体 生成,内容仅供参考,请仔细甄别。
页: [1]
查看完整版本: 【三瑞】品牌123默认伪静态规则