<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	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>pagination URL - Creative Web Dev</title>
	<atom:link href="https://creativewebdev.net/tag/pagination-url/feed/" rel="self" type="application/rss+xml" />
	<link>https://creativewebdev.net</link>
	<description>Create and Develop Your Own Website</description>
	<lastBuildDate>Wed, 13 Aug 2025 00:43:10 +0000</lastBuildDate>
	<language>en-AU</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>

<image>
	<url>https://creativewebdev.net/wp-content/uploads/2025/01/Site-Icon-transparent-100x100.png</url>
	<title>pagination URL - Creative Web Dev</title>
	<link>https://creativewebdev.net</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>如何禁止頁面URL結尾自動添加數字（分頁URL）?</title>
		<link>https://creativewebdev.net/how-to-disable-pagination-urls/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-disable-pagination-urls</link>
					<comments>https://creativewebdev.net/how-to-disable-pagination-urls/#respond</comments>
		
		<dc:creator><![CDATA[Stefan]]></dc:creator>
		<pubDate>Mon, 10 Feb 2025 03:55:57 +0000</pubDate>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Google Search Console]]></category>
		<category><![CDATA[pagination URL]]></category>
		<guid isPermaLink="false">https://creativewebdev.net/?p=7338</guid>

					<description><![CDATA[<p>當你在Google Search Console裡查看網站所有頁面的檢索收錄情況時，往往就會發現有很多URL結尾自動添加了數字，比如2、3或8，甚至更大的雙位數字。</p>
<p>The post <a href="https://creativewebdev.net/how-to-disable-pagination-urls/">如何禁止頁面URL結尾自動添加數字（分頁URL）?</a> first appeared on <a href="https://creativewebdev.net">Creative Web Dev</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>當你在Google Search Console裡查看網站所有頁面的檢索收錄情況時，往往就會發現有很多URL結尾自動添加了數字，比如2、3或8，甚至更大的雙位數字。這種頁面不會被Google收錄，會顯示：Excluded by ‘noindex’ tag。具體如下：</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-7339" title="url pagination" src="https://creativewebdev.net/wp-content/uploads/2025/02/url-pagination.png" alt="url pagination" width="888" height="654" srcset="https://creativewebdev.net/wp-content/uploads/2025/02/url-pagination.png 888w, https://creativewebdev.net/wp-content/uploads/2025/02/url-pagination-300x221.png 300w, https://creativewebdev.net/wp-content/uploads/2025/02/url-pagination-768x566.png 768w, https://creativewebdev.net/wp-content/uploads/2025/02/url-pagination-600x442.png 600w" sizes="(max-width: 888px) 100vw, 888px" /></p>
<h4>為什麼會出現這些分頁URL？</h4>
<p>這些分頁URL的產生，通常是因為：</p>
<ol>
<li>文章中包含了 &lt;!&#8211;nextpage&#8211;&gt; 標記，WordPress 會根據這些標記將文章拆分成多個頁面。</li>
<li>WordPress 在前端顯示時，會根據 &lt;!&#8211;nextpage&#8211;&gt; 標記自動生成不同的分頁URL。</li>
</ol>
<p>這些分頁URL可能會造成SEO問題，特別是如果它們出現重複內容，搜索引擎可能會認為這些頁面是重複的，從而降低網站的排名。這就是為什麼有時候會需要禁用或重定向分頁URL以避免SEO問題。</p>
<p>然而，當您希望禁用這些分頁，並且確保URL中不再出現/2/、/3/等數字時，我們需要進行相應的配置和處理。</p>
<h4>禁用分頁的正確方法</h4>
<h5>1. 禁用文章內的分頁</h5>
<p>若您不希望文章中出現分頁，可以使用wp_link_pages_args這個過濾器來隱藏分頁鏈接。這樣，&lt;!&#8211;nextpage&#8211;&gt; 生成的分頁鏈接將不會顯示，也不會影響文章內容的展示。</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="atomic">function disable_nextpage_pagination( $args ) {
    $args['next_or_number'] = 'number';
    $args['before'] = '&lt;div style="display:none"&gt;';
    $args['after'] = '&lt;/div&gt;';
    return $args;
}
add_filter('wp_link_pages_args', 'disable_nextpage_pagination');
</pre>
<p>這段代碼的作用是將生成的分頁鏈接包裹在一個隱藏的div中，使得這些分頁鏈接不會顯示出來，也不會對文章的內容布局產生影響。這樣用戶將無法看到分頁按鈕。</p>
<h5>2. 屏蔽分頁URL</h5>
<p>即使您禁用了&lt;!&#8211;nextpage&#8211;&gt; 標記，WordPress仍然會生成類似/2/、/3/的URL。為了解決這個問題，我們可以使用301重定向來確保這些分頁URL被自動重定向到文章的原始鏈接。</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="atomic">function block_pagination_urls() {
    if (is_singular() &amp;&amp; preg_match('/\/\d+\/$/', $_SERVER['REQUEST_URI'])) {
        wp_redirect(get_permalink(), 301);
        exit;
    }
}
add_action('template_redirect', 'block_pagination_urls');
</pre>
<p>這段代碼會檢查當前請求的URL是否以/數字/結尾（即分頁URL），如果是，它將會將用戶重定向到原始文章的鏈接，從而避免出現任何分頁URL。</p>
<h5>3. 透過robots.txt阻止搜尋引擎索引分頁URL</h5>
<p>在robots.txt檔案中添加：</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="atomic">User-agent: *
Disallow: */2/
Disallow: */3/
Disallow: */4/
</pre>
<p>防止Google和其他搜尋引擎收錄分頁URL，減少重複內容問題。</p>
<h4>如何防止URL出現分頁數字</h4>
<p>為了防止URL中出現/2/、/3/等數字，您可以：</p>
<ol>
<li>確保文章中沒有使用&lt;!&#8211;nextpage&#8211;&gt;標記。</li>
<li>使用上述代碼來隱藏分頁鏈接並重定向分頁URL。</li>
<li>檢查是否有插件或主題設置造成的分頁，並根據需要禁用或調整它們。</li>
</ol>
<p><span class="yt-core-attributed-string--link-inherit-color" dir="auto"><img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f4a5.png" alt="💥" class="wp-smiley" style="height: 1em; max-height: 1em;" />網站服務器Hostinger(20%折扣鏈接)：</span><span class="yt-core-attributed-string--link-inherit-color" dir="auto"><a class="yt-core-attributed-string__link yt-core-attributed-string__link--call-to-action-color" tabindex="0" href="https://creativewebdev.net/hostinger/" target="_blank" rel="noopener">https://creativewebdev.net/hostinger/</a></span></p>
<p><span class="yt-core-attributed-string--link-inherit-color" dir="auto"><img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f4a5.png" alt="💥" class="wp-smiley" style="height: 1em; max-height: 1em;" />老牌域名註冊商Namesilo優惠碼：<span style="color: #ff0000;">webdev</span></span></p>
<p><span style="font-size: 16px;">在查看完此文章的同時，您會發現以下資源也很有用：</span></p>
<p><img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a title="如何使用WordPress創建一個電子商務網站？從零開始一步一步設計你自己的ONLINE STORE - 2025" href="https://youtu.be/vxOxdZVdQ4Y" target="_blank" rel="noopener">如何使用WordPress創建一個電子商務網站？從零開始-2025</a><br />
<img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a href="https://youtu.be/60p_nta6vUk" target="_blank" rel="noopener">如何順利轉移網站域名到另一個服務供應商？</a><br />
<img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a title="如何順利把網站共享主機轉移到VPS主機？詳細步驟！" href="https://youtu.be/NRfjARhGXAE" target="_blank" rel="noopener">如何順利把網站共享主機轉移到VPS主機？</a><br />
<img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a href="https://youtu.be/pDyKfh7LrBE" target="_blank" rel="noopener">如何免費申請D-U-N-S鄧白氏編碼？</a><br />
<img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a href="https://youtu.be/Ep24hIbbnEg" target="_blank" rel="noopener">如何使用D-U-N-S編號註冊Google公司開發者賬號？</a><br />
<img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a href="https://youtu.be/1VPaR5clJDs" target="_blank" rel="noopener">如何搭建 URL 短鏈接平台？</a><br />
<img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a href="https://youtu.be/er5j8Quf6zA" target="_blank" rel="noopener">如何把網站封裝成 App 並上架 Google 和 Apple？</a><br />
<img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a href="https://youtu.be/8K4pGJRvnL4" target="_blank" rel="noopener">如何創建多語言外貿獨立站？</a><br />
<img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /><a href="https://youtu.be/NNzevfyGYMM" target="_blank" rel="noopener">4 個最流行的WordPress免費主題</a></p>
<p>如果您喜歡這篇文章，請訂閱<a href="https://creativewebdev.net/" target="_blank" rel="noopener">我的網站</a>，您將會收到最新的資源分享信息。您還可以在<a href="https://www.youtube.com/@creativewebdev" target="_blank" rel="noopener">YouTube</a>和<a href="https://www.xiaohongshu.com/user/profile/5fa710300000000001001f72" target="_blank" rel="noopener">小紅書</a>上找到我。</p>
<ol><!-- /wp:paragraph --></ol><p>The post <a href="https://creativewebdev.net/how-to-disable-pagination-urls/">如何禁止頁面URL結尾自動添加數字（分頁URL）?</a> first appeared on <a href="https://creativewebdev.net">Creative Web Dev</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://creativewebdev.net/how-to-disable-pagination-urls/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
