当前位置: 首页 > news >正文

基于php mysql的网站开发如何对seo进行优化

基于php mysql的网站开发,如何对seo进行优化,淄博网站建设至信网络,ip开源网站FPGA可以做点什么Springboot在web层的开发基本都是采用Springmvc框架技术,但是Springmvc中的某些配置在boot是没有的,我们就应该根据自己的需求进行对mvc扩展配置 Springboot1.x版本如何配置 通过注解Configuration一个类,继承webmvcconfigureradapter&#…

Springboot在web层的开发基本都是采用Springmvc框架技术,但是Springmvc中的某些配置在boot是没有的,我们就应该根据自己的需求进行对mvc扩展配置

Springboot1.x版本如何配置


通过注解@Configuration一个类,继承webmvcconfigureradapter,然后根据需求实现里面的方法。

Springboot2.x版本如何配置

通过实现webmvcconfigure接口的方式

上面boot对mvc的扩展配置既保留了mvc的默认配置,也可以使用我们扩展的配置。如何全面接管mvc的配置,所以的webmvc都由我们自己配置?只需要加上注解EnableWebMvc

扩展配置使用举例,如配置拦截器

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;/*** 自定义一个登陆拦截器*/
@Configuration //声明这是一个配置
public class LoginInterceptor extends WebMvcConfigurerAdapter {/*用来添加拦截器的方法InterceptorRegistry registry拦截器注册*/@Overridepublic void addInterceptors(InterceptorRegistry registry) {//使用匿名内部类创建要给拦截器HandlerInterceptor loginInterceptor = new HandlerInterceptor() {@Overridepublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws Exception {//判断session中是否存在用户if (request.getSession().getAttribute("user") == null) {response.sendRedirect("/admin");return false;}return true;}@Overridepublic void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {}@Overridepublic void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {}};registry.addInterceptor(loginInterceptor).addPathPatterns("/admin/**").excludePathPatterns("/admin").excludePathPatterns("/admin/login");}
}

tomcat配置


Springboot默认使用的就是嵌入式servlet容器即tomcat,对于web项目,如果使用的是外部tomcat,相关配置比如访问端口、资源路径等可以在tomcat的conf文件下配置。但是在boot中,tomcat配置又两种方式

第一种:通过配置文件直接配置(推荐)
 

#如果是tomcat相关的设置用server.tomcat.xx
server.tomcat.uri-encoding=UTF-8
#如果是servlet相关的配置用server.xx
server.port=80

 第二种:通过配置类的方式

http://www.yidumall.com/news/49611.html

相关文章:

  • 网站建设作业教程seo的优化方向
  • 今天成都疫情最新消息象山关键词seo排名
  • 网站推广最有效的方法seo长沙
  • 做编程的 网站有哪些内容百度竞价推广有哪些优势
  • 独立外贸网站备案查询
  • 网站建设帮助中心站长网站seo查询
  • 西部数码网站管理助手使用教程查询网站信息
  • 网站优化怎么做的霸榜seo
  • wordpress限制调取文章个数专业seo推广
  • wordpress网站响应很慢网站推广的技术有哪些
  • 静态网站开发实训报告网页分析工具
  • 盈佳国际天天做赢家网站东莞哪种网站推广好
  • 信息化管理系统软件重庆网站优化软件
  • 自做网站视频百度极速版推广员怎么申请
  • 网站建设合同百度文库需要推广的app在哪里找
  • 做网站 的主要收获一站式媒体发稿平台
  • 好看的网站后台优化营商环境发言稿
  • 怎么用lamp做网站苏州网络推广服务
  • 一个好的网站怎样布局百度一下你就知道官网网页版
  • 广州天河区房价搜索优化师
  • 百度不收录网站怎么办b站推广网站2024下载
  • 怎么做动漫原创视频网站seo具体seo怎么优化
  • 企业网站建设前言山东济南最新事件
  • 免备案的网站空间网站seo优化价格
  • 常用的网站类型有哪些类型有哪些软考培训机构排名
  • 个人网店和网站的区别广东深圳疫情最新消息
  • 唐河永琚建筑公司网站郑州网站营销推广公司
  • 站长工具之家seo查询长春seo优化企业网络跃升
  • 网站短链接怎么做广州网站优化页面
  • 有没有教做黄色网站网络营销策划步骤