SEO网址ASP.NET MVC [英] SEO URLs with ASP.NET MVC

查看:126
本文介绍了SEO网址ASP.NET MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个明确的 DO DONT 实施SEO时的网址?很多好的做法似乎罚款。html的网站,但打破了在中型/大型数据库站点。

Is there a definite DO and DONT when implementing seo urls? A lot of good practise seems fine for .html sites but breaks down on medium/large database sites.

据我所知的网址应该为 www.mysite.com/category/page-name-here

AFAIK the url should be www.mysite.com/category/page-name-here

如果我希望做一个内容丰富的网站,并默认的类别和页面的数据库驱动的 - 这是否prevent我不必页面如 www.mysite.com/about www.mysite.com/home 作为约和主页可能会出现冲突。

If I wish to make a content rich site and be default the category and page are database driven - does this prevent me from having pages such as www.mysite.com/about or www.mysite.com/home as the about and home pages could conflict.

虽然路由引擎是柔性的,是在上述不可行和/或有价值的

Although the routing engine is flexible, is the above feasible and/or worthwhile?

-edit -

-edit-

只是为了阐述我的问题,是有可能与数据库来控制路由引擎?

Just to elaborate on my question, is it possible to control the routing engine with a database?

这是个好习惯的URL包含一个有意义的描述 - 例如 stackoverflow.com/category/mvc stackoverflow.com/questions/seo-urls-with-asp-net -mvc 好(相对于 stackoverflow.com/category/9955 stackoverflow.com/questions/734583

It is good practice for the url to contain a meaningful description - eg stackoverflow.com/category/mvc and stackoverflow.com/questions/seo-urls-with-asp-net-mvc is good (as opposed to stackoverflow.com/category/9955 and stackoverflow.com/questions/734583)

作为expirment,我想借此控制到另一个层次,可以说,这两个控制器上面(类别和问题),每个显示动态数据可以被修订为简单的 stackoverflow.com/mvc stackoverflow.com/seo-urls-with-asp-net-mvc

As an expirment, I would like to take the control to another level, lets say that the two controllers above (category and questions), each showing dynamic data could be amended to be simply stackoverflow.com/mvc and stackoverflow.com/seo-urls-with-asp-net-mvc.

我需要确保我的数据库包含一个表,告诉我说,前者是被路由作为一个类别,而后者作为一个问题 - 这可以通过一个简单的数据库查询来实现,将需要中实现Global.asax中

I would need to ensure that my database contained a table that tells me that the former is to be routed as a category and the latter as a questions - this could be achieved by a simple database lookup and would need to be implemented within Global.asax

我的问题是,是否可以实现,这将是潜在的隐患。

My question is, can this be achieved and what would be the potential pitfalls.

推荐答案

它如果添加上述通用的那些哈日codeD路线是可行的轻松:

It's easily feasible if you add the harcoded routes above the generic ones:

// AboutController.Index()
routes.MapRoute( 
    "About",
    "about",
    new { controller = "About", action = "Index" });

// HomeController.Index()
routes.MapRoute( 
    "Home",
    "home",
    new { controller = "Home", action = "Index" });

// ArticleController.Index(string category, string pagename)
routes.MapRoute( 
    "Article",
    "{category}/{pagename}",
    new { controller = "Article", action = "Index" });

他们可能都使用相同的控制器,如果你想要,但如果他们使用独立的人可能更容易一点。

They could all use the same controller if you wanted, but it might be a bit easier if they used separate ones.

您将有唯一的问题是,如果你有一个名为约或家范畴,但这种情况不太可能我会想象。

The only problem you would have with this is if you had a category called "about" or "home" but this is unlikely I would imagine.

还应当指出的是不必使用ASP.NET MVC使用路由能力

这篇关于SEO网址ASP.NET MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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