全国咨询热线:400-865-6067
当前位置:首页 > 行业研究 >

引擎力Google Seo专家整理CSS代码编写要求

来源:引擎力策划部

发布日期:2016-08-22 11:54:29

  1. 头部

<html xml:lang="en" lang="en" xmlns:fb="http://ogp.me/ns/fb#">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<title>demo</title>

<meta property="og:title" content="demo" />

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">

<meta property="og:image" content="https://www.woorank.com/assets/img/og-image.png" />

<meta name="description" content="demo" />

<meta property="og:description" content="demo" />

<link rel="canonical" href="" />

<link rel="shortcut icon" href="/favicon.ico" type="image/ico" />

<meta name="robots" content="noodp" />

  1. 404设置.htaccess文件加入以下代码ErrorDocument 404 /404.html
  2. 301设置.htaccess文件加入以下代码

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www.website.com$

RewriteRule ^/?(.*) http://www.website.com/$1 [QSA,R=301,L]

  1. Windows服务器下web.config文件配置404和www301跳转参考如下

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

    <system.webServer>

        <rewrite>

            <rules>

<rule name="Imported Rule a1" stopProcessing="true">

                    <match url="^(.*)$" ignoreCase="false" />

                    <conditions logicalGrouping="MatchAll">

                        <add input="{HTTP_HOST}" pattern="^www.website.com$" negate="true" />

                    </conditions>

                    <action type="Redirect" url="http://www.website.com/{R:1}" redirectType="Permanent" />

                </rule>

              </rules>

        </rewrite>

        <httpErrors>

            <remove statusCode="404" subStatusCode="-1" />

            <error statusCode="404" prefixLanguageFilePath="" path="/404.html" responseMode="ExecuteURL" />

        </httpErrors>

    </system.webServer>

</configuration>

  1. Breadcrumb设置参考代码

<div xmlns:v="http://rdf.data-vocabulary.org/#">

  <span typeof="v:Breadcrumb">

    <a href="http://www.example.com/books" rel="v:url" property="v:title">

      Books

    </a> ›

    <span rel="v:child" typeof="v:Breadcrumb">

      <a href="http://www.example.com/books/authors" rel="v:url" property="v:title">

        Authors

      </a> ›

      <span rel="v:child" typeof="v:Breadcrumb">

        <a href="http://www.example.com/books/authors/stephenking" rel="v:url" property="v:title">

          Stephen King

        </a> ›

      </span>

    </span>

  </span>

</div>

  1. Viewport设置

<meta name=viewport content="width=device-width, initial-scale=1">

  1. 判断是手机访问网站跳转到wap页面代码

<script type="text/javascript">

       try {

       var urlhash = window.location.hash;

       if (!urlhash.match("fromapp"))

       {

       if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)))

       {

       window.location="http://wap.website.com";

       }

       }

       }

       catch(err)

       {

       }</script>

<>8.手机端和电脑端加载不同css代码

<?php

if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android)/i',strtolower($_SERVER['HTTP_USER_AGENT']))){

echo '<link href="http://www.hswaterslide.com/wood/css/wooddawn_m.css" rel="stylesheet">';

}

else{

echo '<link href="http://www.hswaterslide.com/wood/css/wooddawn.css" rel="stylesheet">';

}?>

 

最新新闻
引擎力Google Seo专家整理CSS代码编写要求引擎力Google Seo专家整理CSS代码编写要求
如何通过社交媒体营销如何通过社交媒体营销
外贸公司如何寻找Google SEO服务商外贸公司如何寻找Google SEO服务商
外贸网站如何做Google  Seo优化外贸网站如何做Google Seo优化
Google排名影响因素之百分比Google排名影响因素之百分比
Google SEO和Google Adwords比较Google SEO和Google Adwords比较
Google SEO关键词选择标准Google SEO关键词选择标准

想要网站优化推广,请留言,引擎力SEO专家将会尽快和您联系!

  • *您的姓名:

    先生
    女士
  • *所在城市:

  • *您的联系电话:

  • 您的QQ:

  • 咨询问题: