如何告诉谷歌我有另一个页面?

发布于 2024-12-22 03:28:11 字数 198 浏览 4 评论 0原文

我有一个 aspx 页面:1.aspx

我的应用程序中没有任何路由,也没有 rewriteurl 模块。

我如何告诉谷歌:

我不再使用 1.aspx

请使用 2.aspx 而不是

他的机器人总是搜索 1.aspx

我如何停止它(并告诉他寻找 2.aspx )?

I have a aspx page : 1.aspx

I Dont have any routes in my app nor rewriteurl module.

How do I tell google :

I dont use 1.aspx anymore

Please use 2.aspx instead

his robots always searching for 1.aspx

How do i stop it ( and tell him to look for 2.aspx instead ) ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

挥剑断情 2024-12-29 03:28:12

使用 robots.txt 文件:

您可以在应用程序的根目录下创建一个 robots.txt 文件,并将以下内容放入其中:

User-agent: Google
Disallow: 1.aspx

更多在 robots.txt 文件上 http://www.robotstxt.org/robotstxt.html


做一个重定向:

Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", "/2.aspx");

在 Global.asax 中不存在该页面的情况下进行重定向:

void Application_BeginRequest(object sender, EventArgs e) {
    string url = Request.Url.ToString().ToLower();
    if (url.Contains("/1.aspx")) {
        Response.Status = "301 Moved Permanently";
        Response.AddHeader("Location", "/2.aspx");
    }
} 

Using a robots.txt file:

You can create a robots.txt file at the root of your application and put the following in it:

User-agent: Google
Disallow: 1.aspx

More on robots.txt files http://www.robotstxt.org/robotstxt.html


Doing a redirect:

Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", "/2.aspx");

Doing a redirect without that page existing in Global.asax:

void Application_BeginRequest(object sender, EventArgs e) {
    string url = Request.Url.ToString().ToLower();
    if (url.Contains("/1.aspx")) {
        Response.Status = "301 Moved Permanently";
        Response.AddHeader("Location", "/2.aspx");
    }
} 
她比我温柔 2024-12-29 03:28:12

谷歌会自动刷新。从您的网站中删除 1.aspx 页面。然后,机器人将查找该文件一段时间,但会扫描其余文件并更新索引。

Google will refresh that automatically. Remove the 1.aspx page from your website. The robot will then look for that file a while but will scan the rest and updates the index.

旧时浪漫 2024-12-29 03:28:12

使用 301 永久重定向。如果您使用的是 .NET < 4.0:

Response.Status = "301 Moved Permanently";
Response.StatusCode = 301;
Response.AddHeader("Location","http://www.new-url.com");
Response.End();

如果您使用 .NET 4.0:

Response.RedirectPermanent("http://www.new-url.com");

您可以了解 301 重定向以及 Google 如何处理它们此处

Use a 301 Permanent Redirect. If you are using .NET < 4.0:

Response.Status = "301 Moved Permanently";
Response.StatusCode = 301;
Response.AddHeader("Location","http://www.new-url.com");
Response.End();

If you are using .NET 4.0:

Response.RedirectPermanent("http://www.new-url.com");

You can learn move about a 301 redirect and how Google handles them here.

二智少女猫性小仙女 2024-12-29 03:28:12

您将需要使用 301 重定向。

这将根据您的技术而有所不同,但是您可以在 http: //www.webconfs.com/how-to-redirect-a-webpage.php

例如在 ASP 中

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.new-url.com/"
%> 

对于 ASP.NET

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com");
}
</script> 

您可以阅读更多内容服务器端重定向至此处:

分别适用于 Microsoft Internet Information Services 和 Apache。

You will want to use a 301 Redirect.

this will vary depending on your technology, however you can find out more at http://www.webconfs.com/how-to-redirect-a-webpage.php

For example in ASP

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.new-url.com/"
%> 

For ASP.NET

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com");
}
</script> 

You can read more on server side redirects here:

For Microsoft Internet Information Services and Apache respectively.

恰似旧人归 2024-12-29 03:28:12

301 将 1.aspx 重定向到 2.aspx。

客户端重定向将强制您保留该页面。通过 IIS(或托管您的应用程序的任何内容)的服务器端重定向将永久使 1.aspx -> 2.aspx。您可以删除该页面,这没有关系。

301 redirect 1.aspx to 2.aspx.

A client side redirect will force you to keep the page. Server side redirect via IIS (or whatever is hosting your app) will permanently make 1.aspx -> 2.aspx. You can delete the page and it won't matter.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文