<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:media="http://search.yahoo.com/mrss/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WP Fastest Cache &#8211; 馬修 IT</title>
	<atom:link href="https://blog.ocam.live/archives/tag/wp-fastest-cache/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.ocam.live</link>
	<description>生活中所接觸各種電腦及網路問題與懷舊模擬器的專業問題解決與新資訊介紹的網站</description>
	<lastBuildDate>Mon, 28 Apr 2025 03:13:50 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://blog.ocam.live/wp-content/uploads/2025/03/cropped-logo-1-300x300.png</url>
	<title>WP Fastest Cache &#8211; 馬修 IT</title>
	<link>https://blog.ocam.live</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>2025 最新 WP Fastest Cache 的外掛產生的 .htaccess 詳解</title>
		<link>https://blog.ocam.live/archives/3749</link>
		
		<dc:creator><![CDATA[blog.ocam.live]]></dc:creator>
		<pubDate>Mon, 28 Apr 2025 03:11:24 +0000</pubDate>
				<category><![CDATA[IT 日常]]></category>
		<category><![CDATA[程式設言]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[WP Fastest Cache]]></category>
		<category><![CDATA[外掛]]></category>
		<guid isPermaLink="false">https://blog.ocam.live/?p=3749</guid>

					<description><![CDATA[什麼是 WP Fastest Cache WP Fastest Cache 是一款非常流行的 WordPres [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading" id="什麼是-wp-fastest-cache">什麼是 WP Fastest Cache</h2>



<p class="wp-block-paragraph"><strong>WP Fastest Cache</strong> 是一款非常流行的 WordPress 快取（Cache）外掛。它的主要作用是幫助你的 WordPress 網站變得更快，提升網站的載入速度和整體效能，對 SEO（搜尋引擎排名）也很有幫助。</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>文章大綱</h2><nav><ul><li class=""><a href="#什麼是-wp-fastest-cache">什麼是 WP Fastest Cache</a></li><li class=""><a href="#為何-wp-fastest-cache-要產生-htaccess-檔案">為何 WP Fastest Cache 要產生 .htaccess 檔案</a><ul><li class=""><a href="#1-啟用靜態快取規則">1. 啟用靜態快取規則</a></li><li class=""><a href="#2-設定-gzip-壓縮">2. 設定 Gzip 壓縮</a></li><li class=""><a href="#3-設定瀏覽器快取（-browser-caching）">3. 設定瀏覽器快取（Browser Caching）</a></li></ul></li><li class=""><a href="#wp-fastest-cache-產生-htaccess-檔案內容解釋。網域會有不同，這裡是用-ocam-live-作範例">WP Fastest Cache 產生 .htaccess 檔案內容解釋。網域會有不同，這裡是用 ocam.live 作範例</a></li><li class=""><a href="#wp-fastest-cache-rewrite-rule-的缺點">WP Fastest Cache Rewrite Rule 的缺點</a></li></ul></nav></div>



<h2 class="wp-block-heading" id="為何-wp-fastest-cache-要產生-htaccess-檔案">為何 WP Fastest Cache 要產生 .htaccess 檔案</h2>



<p class="wp-block-paragraph"><strong>WP Fastest Cache 會產生 <code>.htaccess</code> 檔案</strong>，主要是因為：</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<figure class="wp-block-image size-large"><img decoding="async" src="https://blog.ocam.live/wp-content/uploads/2025/04/htaccess-1-1024x474.png" alt=".htaccess example" class="wp-image-3752" title="2025 最新 WP Fastest Cache 的外掛產生的 .htaccess 詳解"></figure>



<h3 class="wp-block-heading has-medium-font-size" id="1-啟用靜態快取規則">1. <strong>啟用靜態快取規則</strong></h3>



<p class="wp-block-paragraph">WP Fastest Cache 會在 <code>.htaccess</code> 中加上一些 Rewrite Rules（重寫規則），讓伺服器<strong>直接提供已經快取好的 HTML 檔案</strong>，而不是每次都重新跑 WordPress 的 PHP 程式和資料庫查詢。</p>



<p class="wp-block-paragraph">➡️ 這樣做大大減輕了伺服器負擔，也讓頁面打開速度超快。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading has-medium-font-size" id="2-設定-gzip-壓縮">2. <strong>設定 Gzip 壓縮</strong></h3>



<p class="wp-block-paragraph">它會加一些指令，讓伺服器在傳送資料前先壓縮（Gzip 壓縮），減少傳輸的資料量。</p>



<p class="wp-block-paragraph">➡️ 訪客載入網站時，檔案變小，速度變快。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<figure class="wp-block-image size-large"><img decoding="async" src="https://blog.ocam.live/wp-content/uploads/2025/04/htaccess-1024x474.png" alt="htaccess" class="wp-image-3751" title="2025 最新 WP Fastest Cache 的外掛產生的 .htaccess 詳解"></figure>



<h3 class="wp-block-heading has-medium-font-size" id="3-設定瀏覽器快取（-browser-caching）">3. <strong>設定瀏覽器快取（Browser Caching）</strong></h3>



<p class="wp-block-paragraph">在 <code>.htaccess</code> 中加入瀏覽器快取的規則，例如：</p>



<pre class="wp-block-preformatted">apache複製編輯<code>&lt;IfModule mod_expires.c&gt;
  ExpiresActive On
  ExpiresByType image/jpg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ...
&lt;/IfModule&gt;
</code></pre>



<p class="wp-block-paragraph">➡️ 意思是告訴瀏覽器，像圖片這類檔案可以在訪客的電腦上快取一年，下次再進網站時，不用重新載入這些靜態資源。</p>



<h2 class="wp-block-heading" id="wp-fastest-cache-產生-htaccess-檔案內容解釋。網域會有不同，這裡是用-ocam-live-作範例">WP Fastest Cache 產生 .htaccess 檔案內容解釋。網域會有不同，這裡是用 ocam.live 作範例</h2>



<pre class="wp-block-code"><code>條件判斷 (RewriteCond)：
RewriteCond %{HTTPS} =on
只針對 HTTPS 請求生效。

RewriteCond %{HTTP_HOST} ^ocam.live
限定主機為 ocam.live（沒有 www）。

RewriteCond %{HTTP:Cookie} !wordpress_logged_in_&#91;^\=]+\=allen|candy|Admin
排除已登入的三個特定使用者：allen、candy、Admin，他們的登入 cookie 不符合這條件就會觸發 rewrite。

RewriteCond %{HTTP_HOST} ^hehopets.com
再次確認主機名是 ocam.live。

RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WP_FASTEST_CACHE_CSS_VALIDATOR|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot)
排除一些常見的爬蟲或社交媒體預覽機器人。

RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot)
排除 WP Fastest Cache 的預載機器人。

RewriteCond %{REQUEST_METHOD} !POST
只對 GET 等非 POST 的請求處理。

RewriteCond %{REQUEST_URI} !(\/){2,}
避免處理 URL 中有連續兩個以上斜線的請求。

RewriteCond %{THE_REQUEST} !(\/){2,}
同樣防止原始請求中有連續斜線。

RewriteCond %{REQUEST_URI} !&#91;^\/]+\/$
不匹配以目錄形式結尾的 URL（避免重複轉址）。

RewriteCond %{QUERY_STRING} !.+
排除帶有 query string（如 ?id=123）的請求。

RewriteCond %{HTTP:Cookie} !wordpress_logged_in
排除所有已登入的使用者。

RewriteCond %{HTTP:Cookie} !comment_author_
排除有留言者 cookie 的使用者。

RewriteCond %{HTTP:Profile} !^&#91;a-z0-9\"]+ &#91;NC]
不太常見，可能是針對某些特殊裝置的 HTTP Profile 標頭，略過符合條件的 request。

RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f &#91;or]
如果對應的快取 HTML 檔案存在於 DOCUMENT_ROOT 中的快取路徑。

RewriteCond /var/www/pets/wp-content/cache/all/$1/index.html -f
或是在硬編碼指定的目錄下也有對應快取頁面。

RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" &#91;L]
如果上面所有條件都成立，則把請求導向對應的快取 HTML 頁面。

&#91;L] 代表這是最後一條規則，執行後就不再處理其他規則。</code></pre>



<h2 class="wp-block-heading" id="wp-fastest-cache-rewrite-rule-的缺點">WP Fastest Cache Rewrite Rule 的缺點</h2>



<figure class="wp-block-image size-large"><img decoding="async" src="https://blog.ocam.live/wp-content/uploads/2025/04/apache2_wp-faster-cache-683x1024.jpg" alt="cache flow" class="wp-image-3744" title="2025 最新 WP Fastest Cache 的外掛產生的 .htaccess 詳解"></figure>



<p class="wp-block-paragraph">當存取的 URL 裡頭有帶 UTM 等參數時 Rewrite Rule 會失效。換句話說，會改由 PHP 判斷快取要從何處取得。是由已存在的靜態頁檔直接回應還是重新產生。此時該網頁的速度就會大大的減少，個人目測起碼 10 倍以上。這也就是在所有的 wordpress 的快取外掛中少用 UTM 參數。因為會影響到網站反應的速度</p>
]]></content:encoded>
					
		
		
		<media:content url="https://blog.ocam.live/wp-content/uploads/2025/04/wp-fastest-cache.jpg" medium="image"></media:content>
            	</item>
		<item>
		<title>[2025] Rank Math SEO 如何排除 Sitemap.xml 被快取住</title>
		<link>https://blog.ocam.live/archives/3541</link>
		
		<dc:creator><![CDATA[blog.ocam.live]]></dc:creator>
		<pubDate>Thu, 17 Apr 2025 08:51:49 +0000</pubDate>
				<category><![CDATA[IT 日常]]></category>
		<category><![CDATA[Rank Math SEO]]></category>
		<category><![CDATA[Sitemap]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[WP Fastest Cache]]></category>
		<guid isPermaLink="false">https://blog.ocam.live/?p=3541</guid>

					<description><![CDATA[前言 Rank Math SEO 基本功，如何排除 Sitemap 被快取住。現代的 WordPress 的網 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-stackable-heading stk-block-heading stk-block-heading--v2 stk-block stk-mdveryb" id="前言" data-block-id="mdveryb"><h2 class="stk-block-heading__text">前言</h2></div>



<p class="wp-block-paragraph">Rank Math SEO 基本功，如何排除 Sitemap 被快取住。現代的 WordPress  的網站絕大部份都會按裝靜態頁快取程式，如常見的 WP Rocket , W3 Total Cache , LiteSpeed Cache , WP Super Cache , WP Fastest Cache 等。但快取程式如果設定錯誤可能會造成 Google 或 bing 爬蟲抓取被快取的 Sitemap.xml 檔。此時就會產生 Sitemap.xml 裡未包含最新的文章內容。這篇文章就是要教你如何排除此問題</p>



<nav class="wp-block-stackable-table-of-contents stk-block-table-of-contents stk-block stk-zm581tj" data-block-id="zm581tj"><p class="stk-table-of-contents__title">本文主要內容</p><ul class="stk-table-of-contents__table"><li><a href="#前言">前言</a></li><li><a href="#rank-math-seo-之-wp-fastest-cache-發佈文章排除法">Rank Math SEO 之 WP Fastest Cache 發佈文章排除法</a></li><li><a href="#rank-math-seo-之-wp-fastest-cache-特定-url-排除法">Rank Math SEO  之 WP Fastest Cache 特定 URL 排除法</a></li><li><a href="#結論">結論</a></li></ul></nav>



<div class="wp-block-stackable-heading stk-block-heading stk-block-heading--v2 stk-block stk-lcg2u12" id="rank-math-seo-之-wp-fastest-cache-發佈文章排除法" data-block-id="lcg2u12"><h2 class="stk-block-heading__text">Rank Math SEO 之 WP Fastest Cache 發佈文章排除法</h2></div>



<p class="wp-block-paragraph">在發佈新的文章時清理掉全部的快取檔案。此時會把快取檔案全部清掉，就不會有快取到舊的 Sitemap.xml 的問題</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="978" height="535" src="https://blog.ocam.live/wp-content/uploads/2025/04/WP-Fastest-Cache_setting.png" alt="WP Fastest Cache clear all cache" class="wp-image-3572" title="[2025] Rank Math SEO 如何排除 Sitemap.xml 被快取住" srcset="https://blog.ocam.live/wp-content/uploads/2025/04/WP-Fastest-Cache_setting.png 978w, https://blog.ocam.live/wp-content/uploads/2025/04/WP-Fastest-Cache_setting-600x328.png 600w, https://blog.ocam.live/wp-content/uploads/2025/04/WP-Fastest-Cache_setting-860x470.png 860w, https://blog.ocam.live/wp-content/uploads/2025/04/WP-Fastest-Cache_setting-768x420.png 768w" sizes="(max-width: 978px) 100vw, 978px" /></figure>



<div class="wp-block-stackable-heading stk-block-heading stk-block-heading--v2 stk-block stk-55pv4te" id="rank-math-seo-之-wp-fastest-cache-特定-url-排除法" data-block-id="55pv4te"><h2 class="stk-block-heading__text">Rank Math SEO  之 WP Fastest Cache 特定 URL 排除法</h2></div>



<p class="wp-block-paragraph">利用 WP Fastest Cache 的排除功能。排除掉 URL 有特定字串時不要作快取。進入外掛設定頁，選擇排除-&gt;包含。輸入 sitemap 之後按 save 存檔 </p>



<figure class="wp-block-image size-large"><img decoding="async" src="https://blog.ocam.live/wp-content/uploads/2025/04/WP-Fastest-Cache_exclude-1024x711.png" alt="WP Fastest Cache exclude URL" class="wp-image-3575" title="[2025] Rank Math SEO 如何排除 Sitemap.xml 被快取住"></figure>



<div class="wp-block-stackable-heading stk-block-heading stk-block-heading--v2 stk-block stk-ulycks2" id="結論" data-block-id="ulycks2"><h2 class="stk-block-heading__text">結論</h2></div>



<p class="wp-block-paragraph">其它快取程式的操作皆的同小異，當然對於管理者來說最簡單的就是設定發佈文章時清掉全部快取。但有時因為個別網站的大小或營運行為的不同可能不允許經常清掉全部快取，此時使用排除 URL 的特定字串會是另一個可選擇的方式。</p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
		<media:content url="https://blog.ocam.live/wp-content/uploads/2025/04/rank_math_seo.png" medium="image"></media:content>
            	</item>
	</channel>
</rss>
