如何判断一个用户访问" /Default.aspx"或者只是和QUOT; /" [英] How to tell if a user is visiting "/Default.aspx" or just "/"

查看:123
本文介绍了如何判断一个用户访问" /Default.aspx"或者只是和QUOT; /"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写在我的Global.asax.cs的的Application_BeginRequest部分。

I am writing in the Application_BeginRequest part of my Global.asax.cs.

有关搜索引擎优化的目的,我想重定向正在看用户:

For SEO purposes, I'm trying to redirect users that are looking at:

http://www.example.com/Default.aspx

http://www.example.com/

我的问题是:

My question is:

我怎样才能知道哪些用户在看什么?我一直在使用:

How can I tell which the user is looking at? I've been using:

HttpContext.Current.Request.Url.*

但是,所有的参数都相同,无论哪一个,我访问了。

But all the parameters are identical regardless of which one I am visiting.

推荐答案

如果它只是搜索引擎优化,你所关心的,那么你可以使用经典的标签。

If it's just SEO you are concerned about, then you can use the the canonical "tag".

如果你把这个在你的Default.aspx页面:

If you place this in your Default.aspx page:

<link rel="canonical" href="http://www.mysite.com/" />

谷歌将永远指数

Google will always index

http://www.mysite.com/Default.aspx

http://www.mysite.com/

preventing两页被索引,并在搜索结果中竞争。

preventing both pages being indexed and competing in the search results.

您可以在这里阅读更多:的http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html

You can read more here: http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html

这篇关于如何判断一个用户访问&QUOT; /Default.aspx&quot;或者只是和QUOT; /&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆