设置 410 - 特定 url 的状态消失
Set 410 - STATUS GONE for specific url
我们公司的 SEO 专家让我将某些特定页面设置为 410 - 状态消失。
我搜索过在 .htaccess 中声明 410 urls 但我很困惑,因为我不明白是否必须将 google 机器人重定向到另一个 url 或者只是发表声明(只是这些 url 不见了,不要搜索它们,它们已经消失了)。我也对如何做到这一点感到困惑,因为我看到许多不同的代码引用 410,但我不明白哪一个适合我的情况。
我认为下面的代码是我需要的,但我不确定。您能否检查以下几行并告诉我它们是否正确?他们是否将这些 url 设置为 410-status-gone?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Redirect 410 /path_to_file/file1.html
Redirect 410 /path_to_file/file2.html
Redirect 410 /path_to_file/file3.html
</IfModule>
您可以使用:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^path_to_file/(file1|file2|file3)\.html$ - [L,NC,G]
</IfModule>
标志 G
(消失)等同于 R=410
.
我想在我的申请中做同样的事情。这就是我在 .NET 应用程序中所做的。
只需在下面添加 2 行
HttpContext.Current.Response.StatusCode = System.Net.HttpStatusCode.Gone;
HttpContext.Current.ApplicationInstance.CompleteRequest();
干杯
我们公司的 SEO 专家让我将某些特定页面设置为 410 - 状态消失。
我搜索过在 .htaccess 中声明 410 urls 但我很困惑,因为我不明白是否必须将 google 机器人重定向到另一个 url 或者只是发表声明(只是这些 url 不见了,不要搜索它们,它们已经消失了)。我也对如何做到这一点感到困惑,因为我看到许多不同的代码引用 410,但我不明白哪一个适合我的情况。
我认为下面的代码是我需要的,但我不确定。您能否检查以下几行并告诉我它们是否正确?他们是否将这些 url 设置为 410-status-gone?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Redirect 410 /path_to_file/file1.html
Redirect 410 /path_to_file/file2.html
Redirect 410 /path_to_file/file3.html
</IfModule>
您可以使用:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^path_to_file/(file1|file2|file3)\.html$ - [L,NC,G]
</IfModule>
标志 G
(消失)等同于 R=410
.
我想在我的申请中做同样的事情。这就是我在 .NET 应用程序中所做的。
只需在下面添加 2 行
HttpContext.Current.Response.StatusCode = System.Net.HttpStatusCode.Gone; HttpContext.Current.ApplicationInstance.CompleteRequest();
干杯