Nginx301跳转以及Apche301跳转以及IIS301跳转

     最近被各种跳转,烦了,整理下

     先说最简单的nginx

      比如说你的域名为www.maplem.com   maplem.com做301跳转到www.maplem.com

       核心代码

       server_name  www.maplem.com maplem.com;
      if ($host != 'www.maplem.com') {
          rewrite ^/(.*)$ http://www.maplem.com/$1 permanent;
      }

     然后是apche

     <ifmodule mod_rewrite.c>
        RewriteEngine   on
        RewriteRule  /([\d\D]*)/([\d\D]*)/(\w+)_for_(\w+).htm /$1/$2/$4.jsp?no=$3 [PT]
        RewriteRule  /([\d\D]*)/(\w+)_for_(\w+).htm /$1/$3.jsp?no=$2 [PT]

        RewriteCond %{HTTP_HOST} ^maplem.com [NC]
        RewriteRule ^(.*)$ http://www.maplem.com$1 [L,R=301]
        </ifmodule>

        然后是iis,其实IIS最简单,但是比较麻烦,就是把maplem.com作为一个新域名在iis中新增一个,文件路径随便,然后选择为重定向到url,输入到http://www.maplem.com即可

        过几天把apache和nginx配置的也写下

       

你可能感兴趣的:(apache,nginx,IIS)