<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://qingliezhiquan.com/index.php?action=history&amp;feed=atom&amp;title=%E6%80%8E%E4%B9%88%E8%AE%BE%E7%BD%AE%E5%AE%8C%E6%95%B4%E7%9A%84%E3%80%81%E5%AE%8C%E5%96%84%E7%9A%84_301_%E8%B7%B3%E8%BD%AC</id>
	<title>怎么设置完整的、完善的 301 跳转 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://qingliezhiquan.com/index.php?action=history&amp;feed=atom&amp;title=%E6%80%8E%E4%B9%88%E8%AE%BE%E7%BD%AE%E5%AE%8C%E6%95%B4%E7%9A%84%E3%80%81%E5%AE%8C%E5%96%84%E7%9A%84_301_%E8%B7%B3%E8%BD%AC"/>
	<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/index.php?title=%E6%80%8E%E4%B9%88%E8%AE%BE%E7%BD%AE%E5%AE%8C%E6%95%B4%E7%9A%84%E3%80%81%E5%AE%8C%E5%96%84%E7%9A%84_301_%E8%B7%B3%E8%BD%AC&amp;action=history"/>
	<updated>2026-06-20T12:35:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://qingliezhiquan.com/index.php?title=%E6%80%8E%E4%B9%88%E8%AE%BE%E7%BD%AE%E5%AE%8C%E6%95%B4%E7%9A%84%E3%80%81%E5%AE%8C%E5%96%84%E7%9A%84_301_%E8%B7%B3%E8%BD%AC&amp;diff=7923&amp;oldid=prev</id>
		<title>Mwroot: Created page with &quot;有时，为了网址更短，我们往往会利用 .htaccess 实现改写网址。改写前的网址是 abcd.com/loooog/index.php/page.html，改写后的网址是 abcd.com/short/page.html，这样更美观，节约屏幕纵向空间。  在服务器内部实现改写后，会出现一个问题，那就是改写前后的两个网址都能正常访问，对搜索引擎来说不太友好，会抱怨有页面存在大量重复内容。即主观上改写前后是同一个...&quot;</title>
		<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/index.php?title=%E6%80%8E%E4%B9%88%E8%AE%BE%E7%BD%AE%E5%AE%8C%E6%95%B4%E7%9A%84%E3%80%81%E5%AE%8C%E5%96%84%E7%9A%84_301_%E8%B7%B3%E8%BD%AC&amp;diff=7923&amp;oldid=prev"/>
		<updated>2025-09-29T02:14:37Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;有时，为了网址更短，我们往往会利用 .htaccess 实现改写网址。改写前的网址是 abcd.com/loooog/index.php/page.html，改写后的网址是 abcd.com/short/page.html，这样更美观，节约屏幕纵向空间。  在服务器内部实现改写后，会出现一个问题，那就是改写前后的两个网址都能正常访问，对搜索引擎来说不太友好，会抱怨有页面存在大量重复内容。即主观上改写前后是同一个...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;有时，为了网址更短，我们往往会利用 .htaccess 实现改写网址。改写前的网址是 abcd.com/loooog/index.php/page.html，改写后的网址是 abcd.com/short/page.html，这样更美观，节约屏幕纵向空间。&lt;br /&gt;
&lt;br /&gt;
在服务器内部实现改写后，会出现一个问题，那就是改写前后的两个网址都能正常访问，对搜索引擎来说不太友好，会抱怨有页面存在大量重复内容。即主观上改写前后是同一个页面，但对搜索引擎来说却是两个重复的页面，影响 SEO。&lt;br /&gt;
&lt;br /&gt;
我的网站在服务器内部实现改写后，就遇到了这个问题：&lt;br /&gt;
&lt;br /&gt;
[[File:有相同的页面.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
一开始，我只认为是 http 没设置自动跳转 https 的 301 重定向。我设置了。观察了几天。&lt;br /&gt;
&lt;br /&gt;
我发现 Bing Webmaster Tools 依然在抱怨 Too many pages with identicasl titles。我就继续观察，终于发现，对于搜索引擎来说，我的一篇文章，有 8 个不同网址：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1. http://长&lt;br /&gt;
2. http://短&lt;br /&gt;
3. http://www.长&lt;br /&gt;
4. http://www.短&lt;br /&gt;
5. https://长&lt;br /&gt;
6. https://短 （这是我唯一想要搜索引擎关注的）&lt;br /&gt;
7. https://www.长&lt;br /&gt;
8. https://www.短&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8 个网址都被当成了重复的不同页面。&lt;br /&gt;
&lt;br /&gt;
所以，要设置 301 重定向，必须把其他 7 个结果指向唯一想要搜索引擎关注的结果。&lt;br /&gt;
&lt;br /&gt;
在 ChatGPT 的帮助下，通过以下步骤实现：&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1. Redirect HTTP to HTTPS&lt;br /&gt;
2. Redirect non-canonical domains to canonical domains&lt;br /&gt;
3. Redirect /loooog/index.php/* to /short/*&lt;br /&gt;
4. Map /loooog/index.php to /short internally&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
这样就可以了，成功消除 Bing Webmaster Tools 的 Too many pages with identicasl titles 抱怨。&lt;br /&gt;
&lt;br /&gt;
检验是否成功设置 301 跳转的方法：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# 测试的方法&lt;br /&gt;
curl -I http://your-test-url&lt;br /&gt;
# 返回的结果&lt;br /&gt;
HTTP/1.1 301 Moved Permanently&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mwroot</name></author>
	</entry>
</feed>