开发者

ASP: How do you obtain the URL shown in the addressbar for a subdomain in ASP?

My website ArgyleTV.com has several sub开发者_开发知识库domains for multiple languages, i.e. fr.argyletv.com is a french translated version of the website.

The actual path for fr.argyletv.com is argyletv.com/fr/. You can access the same files for that website by typing in essentially 2 different addresses, which is bad for search engine optimization. For instance, fr.argyletv.com/entry.aspx yields the same result as fr.argyletv.com/fr/entry.aspx.

I am trying to determine when the subdomain directory is included in the url, so that I can remove it and redirect the user to the url without the directory via a 301 redirect. The problem that I'm finding is that:

Request.Url.ToString();

Always shows fr.argyletv.com/fr/, even if the address bar shows fr.argyletv.com.

I've also tried to use Request.RawUrl.ToString(); and pretty much every type of output in the request class to no avail.


301 Redirection is still considered as a cool way, but on the other hand do not forget that you will be using your server recources.

If the question is about Search Engine Optimization, maybe instead of using 301 redirects you can use canonical url tag in your head section of html.

<head>
<link rel="canonical" href="http://fr.argyletv.com/" />
</head>

Google respects to canonical url tag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜