【问题标题】:Htaccess modification for ignoring Querystring completely完全忽略查询字符串的 Htaccess 修改
【发布时间】:2016-08-06 13:44:09
【问题描述】:

我在使用 Wordpress + W3 Total Cache + .htaccess + mod_rewrite 时遇到问题。

附加到 URL 的每个查询字符串变量都会导致 Wordpress + Total Cache 重新缓存请求的唯一文件。我知道有人问过这个问题,但是在使用它时,我觉得我没有正确修改我的 .htaccess 文件 - Redirection / htaccess rule to kill off query strings to use wordpress super cache

修改下面的.htaccess文件以支持忽略所有查询字符串变量但让页面上的javascript读取它们的正确方法是什么:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

【问题讨论】:

    标签: php wordpress .htaccess mod-rewrite


    【解决方案1】:

    在所有现有规则之前,但在您重定向的任何规则之后(具有R 标志),试试这个:

    RewriteCond %{THE_REQUEST} \ /[^\ \?]*\?[^\ ]+
    RewriteRule ^ %{REQUEST_URI}? [L]
    

    【讨论】:

      【解决方案2】:
      Options -Indexes
      <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ /teamin/index.php/$1 [QSA,PT,L]
      </IfModule>
      ErrorDocument 404 /404.html
      

      这是我在apache 2.4中使用的,你可以试试!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-04-30
        • 1970-01-01
        • 1970-01-01
        • 2022-10-22
        • 2013-04-08
        • 1970-01-01
        • 1970-01-01
        • 2011-03-04
        相关资源
        最近更新 更多