重定向/ htaccess的规则,扼杀查询字符串用字preSS的超高速缓存用字、字符串、缓存、重定向

2023-09-02 01:06:55 作者:贩梦先生

很惊讶我无法找到这个问题的答案,以便张贴他人,以及获得一些帮助,请。

Quite surprised I could not find the answer to this so posting for others as well as getting some help please.

我有一个非常繁忙的,复杂的字preSS网站。它采用supercache严重。最近,我已经意识到,缓慢的网页速度下降为用户来绕过Supercache的页面,这是因为该网站使用大量的引荐谁进来通过查询字符串类型的URL。

I have a really busy and complicated wordpress site. It uses supercache heavily. Recently I have realised that slow page speed is down to users coming to pages that bypass Supercache, and this is because the site uses lots of referrers who come via query string type URLs.

www.site.co.uk/page/page/?utm_source=newsletter&utm_medium=email&utm_campaign=osale_3&cid=randomstringofnonsense

www.site.co.uk/page/page/?utm_source=newsletter&utm_medium=email&utm_campaign=osale_3&cid=randomstringofnonsense

随着最后一位​​是20串随机字符串网站生成以下链接从无到有,并增加了高速缓存列表。理想情况下,我想他们只是为了要引导到正确的页面,并使用相同的缓存正常的乡亲。换句话说杀死的查询字符串,并使用缓存的原文:

As the last bit is a 20 string random string the site generates this Url from scratch and adds to the cache list. Ideally I would like them just to be to directed to the proper page and use the same cache as normal folks. In other words kill off the query string and use the cached original:

www.site.co.uk/page/page /

这是我迄今为止,但不能得到它重定向或服从。

This is what I have so far, but cannot get it to redirect or obey.

RewriteCond %{QUERY_STRING} ^utm_source=*+$
RewriteRule ^$ /? [R,L]

针对看看这个显著提高服务器的速度,如果是与复归的JavaScript得到任何值从查询字符串返回。 理想情况下,URL不会改变,但用户将送达缓存版本。

Aiming to see if this significantly increases server speed and if so with revert to javascript to get any values back from the query string. Ideally the URL will not change but the user would be served cached version.

请帮助。

在此先感谢,萨姆

推荐答案

我觉得@anubhava已经清理了我们容易的工作; - ):

I think that @anubhava has cleaned up the easy job for us ;-):

RewriteEngine On
RewriteCond %{QUERY_STRING} ^utm_source=
RewriteRule ^(.*)$ /$1? [R,L]

这将做到:

www.site.co.uk/page/page/?utm_source=newsletter&utm_medium=email&utm_campaign=osale_3&cid=randomstringofnonsense => www.site.co.uk/page/page / www.site.co.uk/page/page?utm_source=newsletter&utm_medium=email&utm_campaign=osale_3&cid=randomstringofnonsense => www.site.co.uk/page/page www.site.co.uk/?utm_source=newsletter&utm_medium=email&utm_campaign=osale_3&cid=randomstringofnonsense => www.site.co.uk /