如何搜索引擎优化IIS6下友好现有的ASP.NET 3.5 Web应用程序 [英] How to SEO friendly an existing ASP .NET 3.5 web application under IIS6

查看:179
本文介绍了如何搜索引擎优化IIS6下友好现有的ASP.NET 3.5 Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我知道有很多这样的主题在这里和在互联网上。但大多数的文章/问题,指的是静态URL重写,如:

So, I know there's a lot of this subject here and over the Internet. But most articles/questions refers to "static" url rewriting, like:

www.site.com/products.aspx?category=Books

于是,他们就重写

So they rewrite it to

www.site.com/Products/Books

这没关系,但我需要别的东西。

That's ok but I need something else.

该网站就像一个CMS,它有不同类型的内容。

The site is like a CMS, it has different types of content.

现在读标题为计算器如何帮助您在你的发展的文章,你需要去象下面的网址。

Nowadays to read the article titled "How StackOverflow helps you in your development" you need to go to an URL like the following.

www.site.com/viewContent.aspx?Id=1234

我想才达到的是:

What I want to achive is:

www.site.com/Content/Articles/how-to-stackoverflow-helps-you-in-your-development

所以,按照我的理解,我需要涉及到ASP .NET中,因为首先我需要检索的文章(一个它的当然名称),然后重写URL。

So as I understand, I need to involve ASP .NET in that, because first I need to retrieve the article (an its title of course) and then rewrite the URL.

但我不知道到底ASP .NET怎么会知道如何获得该文章,如果我去那个网址,它不包括ID的任何地方...
所以,也许我能接受像

But I'm wondering how the hell ASP .NET will know how to get that article if I go to that URL, it doesn't include the id anywhere... So maybe I could accept something like

www.site.com/Content/Articles/1234/how-to-stackoverflow-helps-you-in-your-development

我有点丢在这里真的..我从来没有做过任何网址都重写和我GOOGLE了很多,我无法找到一种方法,做我想做的。也许我想要的东西不叫URL重写?我不知道...

I'm kind of lost here really.. I've never done any URL Rewriting at all and I've googled a lot and I cannot find a way to do what I want. Maybe what I want is not called url rewriting??? I don't know...

该网站下的Windows 2003 Server中运行,IIS6,ASP .NET 3.5 SP1
当然,我需要一个免费的解决方案,可以不花100USD的​​ISAPI MOD(除了我不知道这是否会做什么,我需要)。

The site is running under Windows 2003 Server, IIS6, ASP .NET 3.5 SP1 And of course, I need a free solution, cannot spend 100usd on the ISAPI mod (besides I don't know if that is going to do what I need).

感谢所有和遗憾,如果这是一个重复的问题,但我找不到它。

Thanks to all and sorry if this is a duplicated question, but I couldn't find it.

修改:我不需要支持non-ASP.NET文件(JPG格式,GIF格式等),也不需要被重写。我只需要重写viewContent页面包含内容标题到URL。

EDIT: I don't need to support non-ASP.NET files (jpgs, gifs, etc) don't need to be rewritten. I just need to rewrite the viewContent page to include the content title into the URL.

推荐答案

您可以使用新的路由随ASP.Net 3.5 SP1有干净的网址。

You can use the new Routing that comes with ASP.Net 3.5 sp1 to have clean URLs.

这甚至可以在Web表单来完成,而不只是MVC。 (我已经做到了我自己)。请参见这里和的这里如何设置它exanples。

This can even be done in web forms and not just MVC. ( I have done it myself). See here and here for exanples of how to set it up.

您可以扔物品的标识,并在URL的名称和作出的ID被用于搜索的文章真正的参数。这就是也是如此。尝试在网址中删除的问题,它会带你到同一个地方。

You can throw the Id of the article and the title in the URL and make the Id the real parameter that gets used to search for the article. That is what SO does. Try removing the question for the URL and it will take you to the same place.

即使你不使用的ID可以通过文章的标题如何对计算器 - 帮助 - 你 - 在你的发展为你的数据库从其获取基于标题的文章。

Even if you don't use the Id you can pass the title of the article "how-to-stackoverflow-helps-you-in-your-development" to your DB and retreive the article based on the title.

至于IIS 6这是在默认情况下无法处理无扩展名的URL,因为IIS 6有点麻烦。

With regards to IIS 6 it is a little trickier since IIS 6 by default can't handle extension-less URL's.

有一些变通:


  1. 使用IIS中的通配符映射到所有请求映射到Asp.Net

  2. 把Default.aspx的在你的网址的结尾

请参阅本的帖子其他可能的解决方案。

See this post for other possible solutions.

虽然第一溶液可以在一个小网站有性能问题,如果在你的网站上的所有内容经过Asp.Net(甚至图像,CSS,html的...)应该没有关系。我用这个方法,而且没有任何重大的性能问题。我认为这是最简单的解决方案。这里是网站我用它建

Although the first solution may have performance issues if all content in your site goes through Asp.Net (even images, css, .html ...) in a small site it shouldn't matter. I have used this approach and there wasn't any major performance issues. I think it is the simplest solution. Here is the website I built with it

我希望这有助于。

这篇关于如何搜索引擎优化IIS6下友好现有的ASP.NET 3.5 Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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