行业资讯

专注SEO排名技术研发,联系我们获得技术支持!

网站SEO优化必备:常见程序301重定向的做法都有那些?

2023-04-07  浏览:0

  下面简单说在网页当中如何设置301重定向!

  1asp程序:

  <%

  dim Url: Url=request.ServerVariables("HTTP_HOST")

  if Url="ywlcm.net" then

  Response.Status="301 Moved Permanently"

  Response.AddHeader "Location",""

  Response.End

  end if

  %>

  <%

  if request.ServerVariables("HTTP_HOST")<>""then

  Response.Status="301MovedPermanently"

  Response.AddHeader"Location",""

  Response.End

  endif

  %>

  2PHP程序:

  

  $hostdomain=$_SERVER['HTTP_HOST'];

  if ($hostdomain != '') {

  header("HTTP/1.1 301 Moved Permanently");

  header("location:");

  exit();

  }

  ?>

  3伪静态301代码!~

  加在index.php中的

  

  $jump301=1;

  if(substr($_SERVER['SERVER_NAME'],0,4)!=''&&$jump301)

  {

  header('HTTP/1.1 301 Moved Permanently');

  header('Location:'.$_SERVER['SERVER_NAME']);

  exit();

  }

  4js跳转代码

  [xss_clean]

  if(document.domain!='')

  this.location=""+this.location.pathname+this.location.search;

  [xss_clean]

  如有盆友看不懂的,可以给我留言哦,相互学习。

声明:免责声明:本文内容来源于互联网,本网站不拥有所有权,也不承认相关法律责任。
  • 1865692

    累积优化关键词

  • 93%

    +

    首页上词率高达90%+

  • 183W

    +

    183W+独家IP资源

  • 3000

    +

    与3000余家企业客户携手

提供保姆式的SEO优化排名服务,独家研发排名技术,源头技术厂家,快速上首页,帮您获取更多客户资源!

联系我们

TG : @pagoda1993

公司:

九狐科技技术有限公司

地址:江西省南昌市南昌县小蓝国家经济技术开发区汇仁大道266号