原文地址

以前伪静态很流行主要是为了SEO优化排名,现在搜索引擎对静态网站和动态网站的权重差不多了,就没有必要再伪静态了,个人意见,仅供参考。

有些客户要求设置静态的,为了完成需求,而且更简单的做法就是设置伪静态,例如:http://localhost:80/Home/Index.html ,也可以访问http://localhost:80/Home/Index 这是比较简单省力的一个办法,如果每个页面都是生成一个静态,访问速度是提高了,可代码量就增加,我们就可以利用mvc4的路由设置伪静态

        public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute(
"Action1Html", // action伪静态
"{controller}/{action}.html",// 带有参数的 URL
new { controller = "Home", action = "Index", id = UrlParameter.Optional }// 参数默认值
);
routes.MapRoute(
"IDHtml", // id伪静态
"{controller}/{action}/{id}.html",// 带有参数的 URL
new { controller = "Home", action = "Index", id = UrlParameter.Optional }// 参数默认值
); routes.MapRoute(
"ActionHtml", // action伪静态
"{controller}/{action}.html/{id}",// 带有参数的 URL
new { controller = "Home", action = "Index", id = UrlParameter.Optional }// 参数默认值
); routes.MapRoute(
"ControllerHtml", // controller伪静态
"{controller}.html/{action}/{id}",// 带有参数的 URL
new { controller = "Home", action = "Index", id = UrlParameter.Optional }// 参数默认值
);
routes.MapRoute(
"Root",
"",
new { controller = "Home", action = "Index", id = UrlParameter.Optional });//根目录匹配 routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }//默认配置
);
}

最新文章

  1. SQL Server 多条记录的某个字段拼接
  2. Android Canvas设置绘画时重叠部分的处理模式【含效果图】
  3. asp.net mvc,做 301 永久重定向
  4. java的位运算符
  5. Spring + Mybatis 项目实现动态切换数据源
  6. Python爬虫(二十四)_selenium案例:执行javascript脚本
  7. SpringCloud的服务注册中心(二)注册中心服务端和两个微服务应用客户端
  8. 2018-2019-2 网络对抗技术 20165308 Exp3 免杀原理与实践
  9. shell脚本学习-练习写一个脚本2
  10. GitHub 优秀的 Android 开源项目 (精品)
  11. Docker配置参考
  12. 模糊测试(fuzzing)是什么
  13. "留拍"-注册/登录详解
  14. Understanding Flash: Blocks, Pages and Program / Erases
  15. 标准库 os、sys、logging、configparser、time、requests
  16. tkinter模块
  17. Linux 下解压 rar 文件
  18. Tensorflow 方法记录
  19. 关于maven工程打jar的问题
  20. ChemDraw 16最新版本发布 更效率科研的首选

热门文章

  1. 应用程序 /dev/rtc 编程 获取时间 2011-12-13 01:01:06【转】
  2. DMA(direct memory access)直接内存访问
  3. 【POJ 3635】 Full Tank
  4. jsp页面导入excel文件的步骤及配置
  5. 【SQL】INTERVAL YEAR TO MONTH 和 INTERVAL DAY TO SECOND
  6. 安卓手机USB无法共享、上网或卡顿的解决方法
  7. MatLab之Simulink之simple model
  8. 论 fmap、fmap fmap、与 fmap fmap fmap
  9. js消息框
  10. spring IOC bean中注入bean